2 ms·
> So at 4 Mongrels a virtualized server I'd need 250 to serve 1K simulataneous users. Depends on how simultaneous they really are. Are we talking 1000 hits pe
by icky 19y ago
> So at 4 Mongrels a virtualized server I'd need 250 to serve 1K simulataneous users.
Depends on how simultaneous they really are. Are we talking 1000 hits per second? Or are we talking about 1000 unique people viewing some portion of your site/app at a given time?
If it's the latter, you can get away with a lot less.
Also, if you have shared-anything, it will become a bottleneck long before the mongrels. Your database especially will have to be replicated (for read-mostly apps), or sharded (for heavy read-write apps).
If it's a read-mostly app, consider aggressively caching fragments or even pages. (1K users hitting static pages will just hit Apache, given the right set of mod_rewrite rules, and you can have a lot more Apache processes (or threads; is Rails threadsafe these days?) running on a given server than mongrels (which, when I last used Rails, were very resource-hungry).
Consider also ways to extend the functionality of cached/static pages. You could have mod_rewrite check to see if the user has a login cookie and only then hit the non-cached app, OR you could have client-side javascript on the static cached page check for the same cookie and only then display the login name or do an XMLHttpRequest to the server (which then may cache a static html subpage named for that username, which can then be checked by mod_rewrite as well).
Just don't trust non-signed user cookies for looking up private information, or for making any database writes. Signed cookies, however, are a great alternative to centralized sessions (just remember to encrypt anything that you want the user to store, but not see: signing just protects against tampering). Jam the user's IP address into the signed cookie text and guard against replay attacks, as well!
- goodgoblin 19y agoThanks - i'll have to spend some time to grok your suggestions, but for now at least I appreciate them. Re: 1k simulataneous requests - concurrent requests - just didn't want rails to block.