1º parte of the question:
My application is receiving lots of data from a TCP socket and I need to store the data in a MySQL database. Now, I'm just creating a new connection each time I want to query the DB and after the query I'm closing the connection.
I have just one thread to receive the data and store in the database, but I have other threads that are querying the database (they create also new connections), but those ones are slower (queries are more complex). The problem is:
Is It possible that the connections are blocking? (I'm creating and closing connections each time I want to access the DB).
2º parte of the question:
In my research to solve the problem above, I saw that I should use a connection pool, because this could improve the access time to the database.
So I found 5 possibilities to implment that:
As I don't have time to test each of them, I would like to know which one (in your opinion) could present a better performance and less problems to solve...
(I saw somewhere in the Web that dbcp
can give more problems instead of solving them...)
Well depending on the queries and on the quantity of data you retrieve or insert, it may be normal to have a certain performance impact, resulting in slower overall performance.
I think you should try to optimize queries/DB before anything else.
Regarding connection pooling, i have used BoneCP and found it to be very good and fast.