Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Closed Thread
Question on running many background processes
Old 08-07-2010, 02:31 PM Question on running many background processes
Novice Talker

Posts: 5
Trades: 0
Hey guys..... I have a PHP script that I am going to be running in the background on my server; basically what it does is gets "x" amount of results from the database & then does several tasks with the data.... each row can take between about 2 - 90 seconds to process depending on some factors.

So... I was wondering, server wise, is it more beneficial to run 5 threads of this script with each run having the task of 500 rows to process or 50 threads with each run having 50 rows to process?

Why I was wondering is because I came across this quote on another forum when I was reading about background processes..

Quote:
For example, your PHP script should put an entry into a database table and return right away. Then, a cron running every minute checks the queue and forks a process for each job.

The advantage here is that you don't lock an apache thread up for 10 minutes.
Thanks very much for your advice!
cyphix is offline
View Public Profile
 
 
Register now for full access!
Old 08-07-2010, 05:13 PM Re: Question on running many background processes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,390
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Why not simply put the processing work on to the database server. The process and query optimiser can probably do a far better job than you could.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-07-2010, 05:30 PM Re: Question on running many background processes
Novice Talker

Posts: 5
Trades: 0
I'm not quite sure what you mean? Do a better job @ what? All I'm doing with the SQL is a standard select to get the row data.... the heavy load of processing occurs on other tasks.
cyphix is offline
View Public Profile
 
Old 08-07-2010, 05:58 PM Re: Question on running many background processes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,390
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
So why can't the SQL server do some or all of the processing?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-07-2010, 06:05 PM Re: Question on running many background processes
Novice Talker

Posts: 5
Trades: 0
Because last time I checked MySQL didn't do the things I'm doing with the data (taking screenshots, resizing the screenshot + a lot of other data manipulation)
cyphix is offline
View Public Profile
 
Old 08-07-2010, 06:18 PM Re: Question on running many background processes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,390
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Well we are a bit further forward then.

Now!
How about giving us a few more little nuggets so we KNOW what need to be "optimised"???
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-07-2010, 06:31 PM Re: Question on running many background processes
Novice Talker

Posts: 5
Trades: 0
Well not a whole lot more to tell..

Script grabs info from the database with a rather simple query... though the tables may start to get pretty large over time.

For each record the script then goes off & takes a screenshot of of the URL it's told to, resizes the screenshot to create a couple different sized images & then deletes the original. Then it accesses some other remote data & deals with that & at the end it inputs the information gathered into the database.
cyphix is offline
View Public Profile
 
Old 08-07-2010, 07:40 PM Re: Question on running many background processes
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,390
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And you are hoping to do that with just PHP??
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-08-2010, 07:11 AM Re: Question on running many background processes
Novice Talker

Posts: 5
Trades: 0
I'm already doing it all....... so we don't need to worry about that.

All I really need to know is my original question.

Thank You!
cyphix is offline
View Public Profile
 
Closed Thread     « Reply to Question on running many background processes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30102 seconds with 12 queries