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):


Thanks to our forum user fantasydreaming for contributing this tip. 8-)

litespeed_wiki/other-ext-apps/rails-and-memcache-connections.txt · Last modified: 2015/07/29 14:00 by Michael Alegre