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
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?

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.