Re: Memory Leak?
| From: | tg-php at gryffyndevelopment dot com | Date: | Sun, 23 Oct 2005 02:24:25 +0000 |
| Subject: | Re: Memory Leak? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-224495@lists.php.net to get a copy of this message | ||
One other thing to keep in mind. Connecting to a database and disconnecting takes some amount of
time. If you do it in batches of 10, 100, whatever then make sure you only connect and disconnect
once or else you won't have any time savings at all (and will burden the server unnecessarily).
Sucks that you don't have more control over the incoming data.
Good luck in finding a solution.
-TG
= = = Original message = = =
On Sat, October 22, 2005 5:04 pm, tg-php@gryffyndevelopment.com wrote:
> Does it make a difference if instead of one record at a time, you pull
> 10, 20, 100... might speed up your process a little and if it
> doesn't use any more memory, then why not?
I could make a buffer of N lines and read them, I guess.
I kinda figured at 1 line a second, PHP and the OS would have no
problem buffering from the disk.
> Another thought.. can you use database replication here? So instead
> of dumping all the records and processing and inserting the ones that
> are new, you'd only be acting on what's changed since the last backup.
> With real replication, you can do this realtime (or at least
> semi-realtime), but you could simulate replication in your PHP script
> as well.
This data's coming from an external source.
Replication is probably not gonna happen.
Though I am going to ask for a timestamp column so I can ignore rows
that haven't changed since my last import.
That should kill about 90% of the MySQL processing, which seems to be
the biggest CPU sink here.
If that happens, I can probably change the sleep to usleep and a
quarter second or so.
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.