apache processes and mysql connections

6 views
Skip to first unread message

Sem

unread,
Jan 20, 2016, 12:50:09 PM1/20/16
to Coronium IO
Hi,

I've been playing with this on EC2, certainly seems to work. Quick question;

Every time lua code needs to be executed because does apache spawn a process? or is it like a mod where it gets executed by an existing child?

Similar question - if it works like a mod, does it reuse mysql connections, or does it create and destroy for each request?

many thanks,

develephant

unread,
Jan 20, 2016, 5:46:12 PM1/20/16
to coron...@googlegroups.com
Hi,

It depends a little on how you structure your code.

Apache is actually a dependency for some other things, its purpose is more centered around the PHP functionalities, and some of the 3rd party tools. Nginx drives the main process. The Apache process will be removed in the next version.

A module will work as intended, as there is one Lua process per "worker", which on the smaller boxes is one. This will spawn child threads (coroutines). You can not share Lua module data between workers (though you can move it around using a datastore).

The mod will stay in memory between (any) requests until a reboot of the process. As you get to production, you can also turn on Lua code caching, which will give you a boost in speed. Once this is turned on, you have to restart the service for each update, so leave it off while developing.

I will add that you should not rely on a Lua module to keep data between requests, use a datastore.

The MySQL component uses a connection pool, so it does not bring up an entire new connection each time unless needed.

Hope that helps.

Cheers.








Reply all
Reply to author
Forward
0 new messages