A. D.'s Library tagged → View Popular
02 Aug 08
Real world Rails, Part 4: Testing strategies in Ruby on Rails
-
Many developers confuse the ideas behind stubbing and mocking. Stubbing
simply replaces a real-world implementation with a simpler implementation.
In Listing 4, the stub replaced our full login system with a simple
substitute. A stub's job is to simulate the real world. Mocks are
not stubs. A mock object, instead, is like a gauge that measures the way
your application uses an interface. I'll discuss stubs in more detail
later and show you a few examples. -
One of the most critical decisions you'll ever make is how much you test.
If you don't test enough, you'll compromise your code quality and often
even slow down your delivery time. You can test too much, too. Test too
much, and you'll possibly miss deadlines that are important to the
business. To make an informed decision about how much to test, you need to
accurately measure how much you're already testing. One of the most
critical measurements for testing is code coverage.
rails-fast-sessions - Google Code
-
- it creates/updates session on each hit - even dumb bots crawling your sites create thousands of thousands of useless records in your sessions table, 99% of hits do not require any session updates!
- it uses 32-char string as a key for sessions records - all databases work with string keys MUCH slower that with integers keys, so it would be much better to use integers, but we have so long session ids and all session stores use these session ids as a key.
- it uses auto_increment primary key, which causes table-level locks in InnoDB for all MySQL versions prior to 5.1.21. These table-level locks with unnecessary inserts cause really weird problems for large sites.
-
InnoDB groups all data in tables by primary key. This means that when we create auto-increment primary key and insert records to a table, our sessions records are grouped together and saved sequentially on the disk. But if we'll make pretty random value (like crc32 of a random session id) a primary key, then every session record will be inserted in its own place and it will generate some random I/O which is not so good for I/O bound servers.
Selected Tags
Related Tags
Top Contributors
Groups interested in ror
Related Lists on Diigo
-
Rails ActiveMessaging Intro
message plugin for rails
Items: 11 | Visits: 229
Created by: Vincent Tsao
-
ror-project
Items: 1 | Visits: 104
Created by: A. D.
-
RoR development companies in india
Items: 16 | Visits: 9
Created by: Pankaj Bagwan
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo
