Having a server which should be able to handle hundreds of requests at the same time, I decided to do this in python and currently it is up and running, now I'm willing to optimize this code since I want to make this as lightweight as possible.
Having the following server layout:
Incoming connection
||
\/
_________________
| Handling server | <|
|_________________| |
|| |
\/ |
FORKING --------/
||
\/
_________________ 30 Queries ______________
| Dataprocessing | ---------->| MySQL-Server |
|_________________| <----------|______________|
||
\/
RESPONDING & closing connection
What now happens is that if there are x simultaneous incoming connections, the MySQL-server gets really slow for a short amount of time.
Now I am looking for a way to 'merge' different mysql-requests dynamically or to reduce the workload as much as possible.
An example of a question that I could ask for this is:
How can I handle many MySQL-requests in a given timeframe (5 seconds?) while keeping the workload on the MySQL-server as low as possible