New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pre-forking #26

Closed
alexkiro opened this Issue Sep 26, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@alexkiro
Contributor

alexkiro commented Sep 26, 2014

It seems like handling request in separate threads/processes doesn't work well under real traffic conditions. (Although benchmarking PyPy + multi-threading did show some promising results)

We should try and add support for pre-forking, and see how that performs. This does mean will likely need to hack around SocketServer.UDPServer, or even drop using completely and implement our own version.

@alexkiro alexkiro self-assigned this Sep 26, 2014

@alexkiro alexkiro added this to the 1.0 milestone Sep 26, 2014

alexkiro added a commit that referenced this issue Sep 26, 2014

alexkiro added a commit that referenced this issue Oct 28, 2014

Refs. #26. Better handling of pre-forking database connections.
Add a new classmethod to the server engines that yields partial
functions that return a new database connection. This functions
are called in the child process instead of the parent one, thus
preventing any possible issues.

MySQL engines also have a special rule that only enables expiry
on a single database connection, since only one "reorganizing"
daemon thread is necessary.

alexkiro added a commit that referenced this issue Oct 28, 2014

Refs. #26. Add functional tests for pre-forking.
Run basic checks on a Pyzor pre-forked server with mysql and redis
engines (currently the only ones that support pre-forking).

Also switch to using SIGTERM instead of SIGKILL when stopping pyzord
server in functional tests. This ensures a clean shut-down and all
child processes are being stopped.

alexkiro added a commit that referenced this issue Dec 10, 2014

@alexkiro alexkiro closed this Dec 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment