S
S
Slava Kryvel2016-04-16 20:04:50
MySQL
Slava Kryvel, 2016-04-16 20:04:50

What is the best combination of MySQL DB and Python 3 multiprocessing?

I am currently using pymysql. Everything was fine until the moment when it became necessary to parallelize the load.
when using multiprocessing.Poll() the script started to hang.
The only thing that could cause this behavior is using pymysql in subprocesses.
I have one connection to the database, global.
Advise how best to proceed: Use a different connector to the database (which one?) Or create a new connection to the database each time (which, as I understand it, will worsen performance)? Requests are expected up to 5 per second. In the future, I think max up to 10. I
tried to use multiprocessing.Lock () in subprocesses, but this did not give any result.
I understand that this is a bug in pymysql? I would even report it, but I'm not sure if this is not the expected behavior .. maybe I'm doing something wrong?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2016-04-17
@dimonchik2013

are you using exec() or multiexec() ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question