Hi there,
in my current project I am looking at a UDP server which is spawning a thread for each incoming request. This would probably peak at around 50 requests per second.
My question is whether I shall open/close a connection to mySQL within each thread or whether I should create a producer/consumer relationship where the UDP threads would lock a list and queue the request (with callback info) and I would have one mySQL thread working those requests and calling back the individual threads with the results.
Or maybe you suggest a completely different approach?
Thanks for your support!
Best regards,
Tillman
P.S. I remember that I once saw an exception stating that I have reached the maximum open connection pool size - what kind of limit is imposed and is that adjustable?
Performance question
Using connection pool is most recommendable practice.
When using single connection you will face the challenge of connection lifetime and others. I think that it is better to use connection pool. This allows you to use as less as possible physical connections with better performance. The approach with queuing can be used when there are too much user requests that produce too much connections. In this case I recommend to use connection pool in combination with queuing.
When using single connection you will face the challenge of connection lifetime and others. I think that it is better to use connection pool. This allows you to use as less as possible physical connections with better performance. The approach with queuing can be used when there are too much user requests that produce too much connections. In this case I recommend to use connection pool in combination with queuing.