开发者

Lost connection to MySQL server during query mysqlclient-dev multithreading

开发者 https://www.devze.com 2023-03-07 00:07 出处:网络
Folks, I had another issue now regarding to libmysqlclient-dev api Here the story: I created about 10 threads which will do SQL query in every 2 seconds, and loop,

Folks, I had another issue now regarding to libmysqlclient-dev api

Here the story:

I created about 10 threads which will do SQL query in every 2 seconds, and loop, in math you could say 10 query in 2 seconds in the same time, and it ended itself with MySQL error message lost connection during SQL query

Questions:

  1. in these case, is my algorithm will always cause MySQL server lost co开发者_运维百科nnection ?
  2. if so, will these issue appear if I use another db (say Oracle, Postgre, etc), or result will same?


  1. What are you doing in the thread that loses the connection, and what are the other threads doing at the same time?
  2. It depends. Consider your question the equivalent of "my car makes a funny noise when I drive down Street X. Should I get a new car?". If the noise is due to you falling into a pothole, changing cars won't make any difference.


well everything is now run better once

  • the MYSQL* is protected by posix-mutex https://computing.llnl.gov/tutorials/pthreads/#MutexLocking
  • the code compiiled with mysql_config --libs_r parameter

thats for now, any addition ?

0

精彩评论

暂无评论...
验证码 换一张
取 消