Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: users

Help with PHP/cherokee settings.

 

 

Cherokee users RSS feed   Index | Next | Previous | View Threaded


superman.jason at gmail

Jun 18, 2009, 10:47 AM

Post #1 of 7 (865 views)
Permalink
Help with PHP/cherokee settings.

Hi All,

While I've got the experts at work I'd like to request a little more help if I
could.

I find cherokee processes php files very quickly most of the time. The only
times I run into problems is when there's a time delay in processing an action.

For example, the php gallery I've been using (Singapore - http://sgal.org/ - old
but still works well!) works fine except when I add new images. The script
processes the added files and creates & caches the newly resized images for
thumbnails, page display etc. When this is taking place if the image is large,
or there are several images to process I'll often get a 504 gateway timeout, or
a 500 server error message. If I keep refreshing eventually I'll get back to the
page. I'm guessing this is because cherokee times out when waiting for a
response from php-cgi or something like that.

Another example is in Zen Cart. (http://www.zen-cart.com/) In the admin
interface there's an option to email customers. Our customer list is quite large
(2-3000). Although you may only want to email 1 customer, when you select this
option it parses all the customers in the MySQL database to add them to the
drop-down list of available recipients. As you can guess this takes a LONG time
with so many customers, and the admin page starts rendering the header, then
gets a page load error: Connection Interupted. If I look at top on the FreeBSD
server, mysqld is still working away, but I guess either php-cgi has lost
communication with it, or cherokee with php-cgi, or a combination. MySQL
continues to parse the request, but trying to re-access the page actually
restarts the request and continues with same problem.

Both these instances when using Apache with mod_php will take a long time to
render the page, but it never times out or looses connection. (The Zen email
customers page takes 10+ to complete.)

Is there some settings I can tweak in cherokee or php.ini or my.cnf that will
help? Have any of you been able to solve such an issue?

_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


alvaro at alobbs

Jun 19, 2009, 9:57 AM

Post #2 of 7 (851 views)
Permalink
Re: Help with PHP/cherokee settings. [In reply to]

Hello Jason,

On 18-jun-09, at 19:47, Jason wrote:

> While I've got the experts at work I'd like to request a little more
> help if I
> could.
>
> I find cherokee processes php files very quickly most of the time.
> The only
> times I run into problems is when there's a time delay in processing
> an action.
>
> For example, the php gallery I've been using (Singapore - http://sgal.org/
> - old
> but still works well!) works fine except when I add new images. The
> script
> processes the added files and creates & caches the newly resized
> images for
> thumbnails, page display etc. When this is taking place if the image
> is large,
> or there are several images to process I'll often get a 504 gateway
> timeout, or
> a 500 server error message. If I keep refreshing eventually I'll get
> back to the
> page. I'm guessing this is because cherokee times out when waiting
> for a
> response from php-cgi or something like that.

Yes, it looks like it. Cherokee closes the connection if php doesn't
return any information within the server-wide timeout limit.

The second option would be that all your php-cgi child processes were
busy running 'gd' or 'imagemagick'. In that case the server would
reply with a 504 error because it wouldn't be able to connect with php.

Try this:

<?php
for ($i=0; $i<100; $i++) {
phpinfo();
sleep (10);
}
?>

as long as sleep() < timeout the server will run fine.

--
Octality
http://www.octality.com/

_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


superman.jason at gmail

Jun 19, 2009, 2:56 PM

Post #3 of 7 (845 views)
Permalink
Re: Help with PHP/cherokee settings. [In reply to]

Alvaro Lopez Ortega <alvaro <at> alobbs.com> writes:

>
> Hello Jason,
>
> On 18-jun-09, at 19:47, Jason wrote:
>
> > While I've got the experts at work I'd like to request a little more
> > help if I
> > could.
> >
> > I find cherokee processes php files very quickly most of the time.
> > The only
> > times I run into problems is when there's a time delay in processing
> > an action.
> >
> > For example, the php gallery I've been using (Singapore - http://sgal.org/
> > - old
> > but still works well!) works fine except when I add new images. The
> > script
> > processes the added files and creates & caches the newly resized
> > images for
> > thumbnails, page display etc. When this is taking place if the image
> > is large,
> > or there are several images to process I'll often get a 504 gateway
> > timeout, or
> > a 500 server error message. If I keep refreshing eventually I'll get
> > back to the
> > page. I'm guessing this is because cherokee times out when waiting
> > for a
> > response from php-cgi or something like that.
>
> Yes, it looks like it. Cherokee closes the connection if php doesn't
> return any information within the server-wide timeout limit.
>
> The second option would be that all your php-cgi child processes were
> busy running 'gd' or 'imagemagick'. In that case the server would
> reply with a 504 error because it wouldn't be able to connect with php.
>
> Try this:
>
> <?php
> for ($i=0; $i<100; $i++) {
> phpinfo();
> sleep (10);
> }
> ?>
>
> as long as sleep() < timeout the server will run fine.
>
> --
> Octality
> http://www.octality.com/
>

Hi Alvaro,

Thanks for your reply. You are always great at helping us all out! Great product
too!


As for the php loop, I well try that later. I take it this is just to test the
timeout? A loop reading phpinfo.

And definitely with the gallery it is GD or ImageMagick doing some processing.
That one is okay, I just make sure to go through all the new pics myself so that
they get processed and nobody coming to the site later gets the timeout.

I wish I could figure out a way for the Zen Cart, PHP, MySQL thing though, but I
would have to set the timeout to a ridiculously huge number to allow for that. I
think the client should maybe start pruning their customer list... ;) At least
the problem is only in the admin interface.

Is there any number that is kinda the ideal for the site wide timeout? And how
about the largest number that is feasible?

Thanks again,
Jason

_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


pablosaro at gmail

Jun 19, 2009, 4:50 PM

Post #4 of 7 (844 views)
Permalink
Re: Help with PHP/cherokee settings. [In reply to]

Hi Jason,

Regarding the Zend cart (BTW I've never used it) I think it is not a
good idea to fill a combo box with data in a MySQL table for about 30K
rows (and the possibility of becoming larger). Just think about MySQL
times and PHP times... Ugh...
Why not having that list cached somewhere and perform a search over the cache?
I don't know if it is possible with Zend cart.
Sorry if it is out of list's scope.

Pablo




On 6/19/09, Jason <superman.jason [at] gmail> wrote:
> Alvaro Lopez Ortega <alvaro <at> alobbs.com> writes:
>
>>
>> Hello Jason,
>>
>> On 18-jun-09, at 19:47, Jason wrote:
>>
>> > While I've got the experts at work I'd like to request a little more
>> > help if I
>> > could.
>> >
>> > I find cherokee processes php files very quickly most of the time.
>> > The only
>> > times I run into problems is when there's a time delay in processing
>> > an action.
>> >
>> > For example, the php gallery I've been using (Singapore -
>> > http://sgal.org/
>> > - old
>> > but still works well!) works fine except when I add new images. The
>> > script
>> > processes the added files and creates & caches the newly resized
>> > images for
>> > thumbnails, page display etc. When this is taking place if the image
>> > is large,
>> > or there are several images to process I'll often get a 504 gateway
>> > timeout, or
>> > a 500 server error message. If I keep refreshing eventually I'll get
>> > back to the
>> > page. I'm guessing this is because cherokee times out when waiting
>> > for a
>> > response from php-cgi or something like that.
>>
>> Yes, it looks like it. Cherokee closes the connection if php doesn't
>> return any information within the server-wide timeout limit.
>>
>> The second option would be that all your php-cgi child processes were
>> busy running 'gd' or 'imagemagick'. In that case the server would
>> reply with a 504 error because it wouldn't be able to connect with php.
>>
>> Try this:
>>
>> <?php
>> for ($i=0; $i<100; $i++) {
>> phpinfo();
>> sleep (10);
>> }
>> ?>
>>
>> as long as sleep() < timeout the server will run fine.
>>
>> --
>> Octality
>> http://www.octality.com/
>>
>
> Hi Alvaro,
>
> Thanks for your reply. You are always great at helping us all out! Great
> product
> too!
>
>
> As for the php loop, I well try that later. I take it this is just to test
> the
> timeout? A loop reading phpinfo.
>
> And definitely with the gallery it is GD or ImageMagick doing some
> processing.
> That one is okay, I just make sure to go through all the new pics myself so
> that
> they get processed and nobody coming to the site later gets the timeout.
>
> I wish I could figure out a way for the Zen Cart, PHP, MySQL thing though,
> but I
> would have to set the timeout to a ridiculously huge number to allow for
> that. I
> think the client should maybe start pruning their customer list... ;) At
> least
> the problem is only in the admin interface.
>
> Is there any number that is kinda the ideal for the site wide timeout? And
> how
> about the largest number that is feasible?
>
> Thanks again,
> Jason
>
> _______________________________________________
> Cherokee mailing list
> Cherokee [at] lists
> http://lists.octality.com/listinfo/cherokee
>

--
Sent from Gmail for mobile | mobile.google.com
_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


alvaro at alobbs

Jun 20, 2009, 6:17 AM

Post #5 of 7 (835 views)
Permalink
Re: Help with PHP/cherokee settings. [In reply to]

On 19-jun-09, at 23:56, Jason wrote:

> I wish I could figure out a way for the Zen Cart, PHP, MySQL thing
> though, but I
> would have to set the timeout to a ridiculously huge number to allow
> for that. I
> think the client should maybe start pruning their customer
> list... ;) At least
> the problem is only in the admin interface.
>
> Is there any number that is kinda the ideal for the site wide
> timeout? And how
> about the largest number that is feasible?


Actually, we ought to improve the timeout support so different values
could be defined for the client-server connection and the server-
fastcgi. In that way, you could set a higher value for the FastCGI
connection while the client-server timeout value remains the same.

Could you please log for a bug for this? It looks like something
worth implementing in the upcoming releases, actually.

--
Octality
http://www.octality.com/

_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


superman.jason at gmail

Jun 20, 2009, 9:53 AM

Post #6 of 7 (836 views)
Permalink
Re: Help with PHP/cherokee settings. [In reply to]

Alvaro Lopez Ortega <alvaro <at> alobbs.com> writes:

> Could you please log for a bug for this? It looks like something
> worth implementing in the upcoming releases, actually.

Hi Alvaro,

Okay, I filed the bug.

Thanks,
Jason

_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee


superman.jason at gmail

Jun 20, 2009, 10:07 AM

Post #7 of 7 (842 views)
Permalink
Re: Help with PHP/cherokee settings. [In reply to]

Pablo Hernan Saro <pablosaro <at> gmail.com> writes:

> Hi Jason,
>
> Regarding the Zend cart (BTW I've never used it) I think it is not a
> good idea to fill a combo box with data in a MySQL table for about 30K
> rows (and the possibility of becoming larger). Just think about MySQL
> times and PHP times... Ugh...
> Why not having that list cached somewhere and perform a search over the cache?
> I don't know if it is possible with Zend cart.
> Sorry if it is out of list's scope.
>
> Pablo


Hi Pablo,

Thanks for your reply. I don't know exactly how to make those changes in Zen
Cart itself without looking through a bunch of the code. However, your idea of
changing something in Zen Cart itself reminded me that I could probably search
the forum for it and maybe find a solution.

I found one that speeds up the SQL request significantly. Here's what was
suggested:

DELETE FROM query_builder where query_name = \
'Customers who have never completed a purchase';

So I guess it was this query that caused the long delay as it compared each
customer with the tables that would indicate if they've made a purchase or not.
A nice feature I think, but I'd rather have the less than 10 second delay for
the email page with it disabled versus the more than 10 minute delay with the
feature enabled.

Maybe that will help other cherokee/zen-cart users at some point.

Anyway, it looks like Alvaro is going to implement separate timeouts for the
Client-Server connection and the Server-FastCGI, so that may help similar
situations in the future!

Thanks,
Jason

_______________________________________________
Cherokee mailing list
Cherokee [at] lists
http://lists.octality.com/listinfo/cherokee

Cherokee users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.