Jump to content

MySQL or MySQLi, which should I use?


benphelps

Recommended Posts

I have a script that forks out PHP processes and each one makes a new MySQL connection.  I fork the processes because each one could run anywhere from 0.5sec to 4-5min and I need them all to complete as fast as possible and I cant wait for the longer running jobs to complete in a while loop.  Each batch could start from 80-200 processes.  Each processes makes about 10 MySQL changes.

 

When I start the fork processes MySQL RAM usage jumps up to about 300mb.  Would using MySQLi speed up the processes or lower memory usage?

 

Any insight will be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/166417-mysql-or-mysqli-which-should-i-use/
Share on other sites

i think the flat file would make no difference,

because off all the info needed collecting then.

 

the only thing i can think off is faster bandwidth.

 

sounds like each fork the program takes, there bandwidth is busy causing your program to slow down?

 

if your doing any select statments put an index on the tables.

 

create a singleton connection class store the instance in session then controle all the processes connections from that one method if you can.

 

try to do any processing in php rather than sql, reduce regex, you could cluster some servers and connect to different ones using the singleton class that way you will have different mysql servers you work with but all of them have the same data

 

in the connection class check to see if there is a connection to one server if there is then connect to cluster server 2 instead etc etc

 

you could limit the no of processes see if that helps, limit the no of queries made and put them on the backburner

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.