Differences
This shows you the differences between two versions of the page.
— |
litespeed_wiki:other-ext-apps:rails-and-memcache-connections [2015/07/29 14:00] (current) Michael Alegre created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Tip about using Memcache with LSAPI ====== | ||
+ | Litespeed attempts to make starting up very fast, and it does so by initializing Rails framework in a parent process, then doing the fork. That way, all that disk-scouring to find all the rails files, which takes about 6 seconds of heavy iowait, is only done once. | ||
+ | |||
+ | However it also means that any connections you initialize will also be shared among child processes. | ||
+ | |||
+ | Database connections - the LSAPI parent process explicitly disconnects after loading, so they'll be re-initialized for each child. | ||
+ | |||
+ | Memcache connections you need to do yourself. I do so at the bottom of my environment.rb (I'm using memcache-client, which sets a global CACHE): | ||
+ | |||
+ | CACHE.reset | ||
+ | |||
+ | Thanks to our forum user fantasydreaming for contributing this tip. 8-) | ||