Hi Erel!
Thank you for your response!
I have already done the configuration of the connection pool.
A few hours after my previous post, I finally found where my problem was:
I had created the two tables of the messages with XtraDB (InnoDB) storage engine.
When the congestion occured, I simply changed the storage engine from XtraDB to Aria (MyISAM) and the congestion disapeared immediately!
The database is MariaDB 10.0.14.
The strange case is that I have optimized the database for InnoDB engine.
It seems that the data flow is so fast that the transactional mode cannot handle it!
P.S. I've just noticed that I have confused all the readers of this post. I forgot to mention that the old 4.0 MySQL version is the one that holds all my central application's data, and all requests from the websocket server are ended up there!
The new MariaDB instance is the database of the websocket server.
I was supposing that the problem comes from the old instance but finally was the new instance that was having a very big delay to deliver the answers from the old system!