Chris McComas | 3 May 14:34 2011
Picon

Question

I'm using CloudFlare with my site www.cloudflare.com. CloudFlare acts
as a reverse proxy, so all connecting IPs to my site come from one of
CloudFlare's IPs. They pass the the originating IP in the header, what
would be the best way to handle this with Cherokee, to preserve my
logs, etc?

I know they've created mod_cloudflare for Apache to handle this...

https://github.com/cloudflare/CloudFlare-Tools/raw/master/mod_cloudflare.c
Alvaro Lopez Ortega | 3 May 15:47 2011

Re: Question

Hello Chris,

On Tue, May 3, 2011 at 2:34 PM, Chris McComas <mccomas.chris <at> gmail.com> wrote:
I'm using CloudFlare with my site www.cloudflare.com. CloudFlare acts
as a reverse proxy, so all connecting IPs to my site come from one of
CloudFlare's IPs. They pass the the originating IP in the header, what
would be the best way to handle this with Cherokee, to preserve my
logs, etc?

Cherokee supports X-Real-IP. If that's the header, you'll only have to enable in your logging configuration.

--
Greetings, alo
http://www.octality.com/
_______________________________________________
Cherokee mailing list
Cherokee <at> lists.octality.com
http://lists.octality.com/listinfo/cherokee
ALBERT HIDALGO BAREA | 5 May 09:16 2011
Picon

Cherokee PHP FastCGI isue

Hi,

 

I am doing a benchmark of Cherokee web server. When configuring Cherokee with Fast CGI for PHP language I have the following issue.

When setting ab (Apache Benchmark) tool to send a concurrency of above 250 simultaneous clients, Cherokee takes the 200% of the processor (take into account that is a dual core machine), this provokes a decrease of performance.

 

From 1 to 100 simultaneous clients I get a performance around 5000 requests per second, with a Hello World PHP file.

But when increasing from 150 up to 1000 simultaneous clients, performance goes down to 100 requests per second.

My system is a Dual core machine, with Red Hat Enterprise Linux 5.5.

 

There is something to configure in order to avoid this issue? Maybe I have to limit the number of threads which Cherokee can handle.

 

Thank you.

Regards,


Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at.
http://www.tid.es/ES/PAGINAS/disclaimer.aspx
_______________________________________________
Cherokee mailing list
Cherokee <at> lists.octality.com
http://lists.octality.com/listinfo/cherokee
Alvaro Lopez Ortega | 5 May 10:06 2011

Re: Cherokee PHP FastCGI isue

Hello Albert,

On Thu, May 5, 2011 at 9:16 AM, ALBERT HIDALGO BAREA <abarea <at> tid.es> wrote:

From 1 to 100 simultaneous clients I get a performance around 5000 requests per second, with a Hello World PHP file.

But when increasing from 150 up to 1000 simultaneous clients, performance goes down to 100 requests per second.

My system is a Dual core machine, with Red Hat Enterprise Linux 5.5.

 

There is something to configure in order to avoid this issue? Maybe I have to limit the number of threads which Cherokee can handle.


There are two things to take into account here:

  • First, the number of child processes of php-cgi (or php-fpm). Odds are the bottleneck is not in Cherokee, actually. When php does not have worker processes to handle the requests things do get very slow.

  • Check your kernel limits. It's very usual to reach them when performing benchmarks. If the allocated resources of the kernel are exhausted (ports, file descriptors, etc) the results of the benchmark will not represent the real performance of the server in a tuned system. This document may come useful; check it out.

--
Greetings, alo
http://www.octality.com/
_______________________________________________
Cherokee mailing list
Cherokee <at> lists.octality.com
http://lists.octality.com/listinfo/cherokee
Alvaro Lopez Ortega | 5 May 11:49 2011

Re: Cherokee PHP FastCGI isue

Hello Albert,


I do not think the thread number has much to do to that performance decrease you described, actually. Instead, I believe it's more likely related to the number to PHP child processes and/or system resources exhaustion. 

I'd personally increase the PHP_FCGI_CHILDREN as a first step (do not hesitate to set a much higher number). Then, I'd focus on being sure that neither your system's ephemeral ports poll nor your file descriptor poll is exhausted during the benchmark, etc. That's a very usual problem that causes the sort of issue you described.

Cheers!


On Thu, May 5, 2011 at 11:07 AM, ALBERT HIDALGO BAREA <abarea <at> tid.es> wrote:

Thanks for the answer.

 

I run the FastCGi with:

                source!1!env!PHP_FCGI_CHILDREN = 8

source!1!env!PHP_FCGI_MAX_REQUESTS = 5000

And the server itself:

                server!fdlimit = 65535

server!iocache = 0

server!keepalive = 1

server!keepalive_max_requests = 2000

server!poll_method = epoll

 

Trying to solve this issue, I limited the threads that Cherokee uses. By default Cherokee calculates the number of threads (I don’t know the exact number), but if I set the number of threads to 2 when there are 250 simultaneous clients the performance is around 3000 requests per second.

 

Scenario 1:

If I run TOP in Linux, I see that when running 100 simultaneous clients, Cherokee gets less than  100% of the CPU load and some php-cgi processes are created (and of course consuming resources). Gets a performance around 5000 requests per second.

But if running more than 100 simultaneous clients, Cherokee gets 200% CPU load and php-cgi does not appear in the same frequency in TOP. Performance decreases to less than 100 requests per second.

 

Scenario 2:

When limiting the number of threads to 2, the performance when running less than 100 simultaneous clients decreases a little bit, less than 5000 requests per second.

But when pushing 200 simultaneous clients, performance is around 3000-3500 requests per second. If I run TOP in Linux, I see the same behavior than in the first part of the scenario 1. Cherokee consuming between 100% and 120% of CPU and php-cgi processes being created.

 

Maybe it is as simple as limiting the number of threads, in order to get fewer resources.

 

Regards,

 

De: Alvaro Lopez Ortega [mailto:alvaro <at> octality.com]
Enviado el: jueves, 05 de mayo de 2011 10:06
Para: ALBERT HIDALGO BAREA
CC: cherokee <at> lists.octality.com
Asunto: Re: [Cherokee] Cherokee PHP FastCGI isue

 

Hello Albert,

On Thu, May 5, 2011 at 9:16 AM, ALBERT HIDALGO BAREA <abarea <at> tid.es> wrote:

From 1 to 100 simultaneous clients I get a performance around 5000 requests per second, with a Hello World PHP file.

But when increasing from 150 up to 1000 simultaneous clients, performance goes down to 100 requests per second.

My system is a Dual core machine, with Red Hat Enterprise Linux 5.5.

 

There is something to configure in order to avoid this issue? Maybe I have to limit the number of threads which Cherokee can handle.


There are two things to take into account here:

 

  • First, the number of child processes of php-cgi (or php-fpm). Odds are the bottleneck is not in Cherokee, actually. When php does not have worker processes to handle the requests things do get very slow.
  • Check your kernel limits. It's very usual to reach them when performing benchmarks. If the allocated resources of the kernel are exhausted (ports, file descriptors, etc) the results of the benchmark will not represent the real performance of the server in a tuned system. This document may come useful; check it out.


--
Greetings, alo
http://www.octality.com/


Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at.
http://www.tid.es/ES/PAGINAS/disclaimer.aspx



--
Greetings, alo
http://www.octality.com/
_______________________________________________
Cherokee mailing list
Cherokee <at> lists.octality.com
http://lists.octality.com/listinfo/cherokee
Chris McComas | 6 May 21:02 2011
Picon

Re: Question

I got my Cherokee configured with CloudFlare and I'm getting the
originator's IP. I added an entry to CloudFlare's wiki on how to do
this:

http://www.cloudflare.com/wiki/Cherokee#Restoring_Originating_IPs_for_Cherokee_Users

On May 3, 9:47 am, Alvaro Lopez Ortega <alv... <at> octality.com> wrote:
> Hello Chris,
>
> On Tue, May 3, 2011 at 2:34 PM, Chris McComas <mccomas.ch... <at> gmail.com>wrote:
>
> > I'm using CloudFlare with my sitewww.cloudflare.com. CloudFlare acts
> > as a reverse proxy, so all connecting IPs to my site come from one of
> > CloudFlare's IPs. They pass the the originating IP in the header, what
> > would be the best way to handle this with Cherokee, to preserve my
> > logs, etc?
>
> Cherokee supports X-Real-IP. If that's the header, you'll only have to
> enable in your logging configuration.
>
> --
> Greetings, alohttp://www.octality.com/
>
> _______________________________________________
> Cherokee mailing list
> Chero... <at> lists.octality.comhttp://lists.octality.com/listinfo/cherokee
Alvaro Lopez Ortega | 6 May 23:52 2011

Re: Question

Hello Chris,


On Fri, May 6, 2011 at 9:02 PM, Chris McComas <mccomas.chris <at> gmail.com> wrote:
I got my Cherokee configured with CloudFlare and I'm getting the
originator's IP. I added an entry to CloudFlare's wiki on how to do
this:

http://www.cloudflare.com/wiki/Cherokee#Restoring_Originating_IPs_for_Cherokee_Users

Good to know!

Thanks for getting back. :)

--
Greetings, alo
http://www.octality.com/
_______________________________________________
Cherokee mailing list
Cherokee <at> lists.octality.com
http://lists.octality.com/listinfo/cherokee
David Bonilla | 7 May 11:27 2011
Picon

Problems migrating Wordpress MU from Apache to Cherokee (Rewrite help needed)

Hi there,


I'm a Cherokee newbie. We are trying to migrate our corporate blogging system (an old Wordpress MU, now updated to Wordpress 3.1.2 configures to support multiblog). The point is Wordpress uses the Apache's Mod Rewrite to manage the multiblog system.

When you type http://www.yoursite.com/blog/david, Wordpress redirect the request to a terrific PHP script (now ms-files.php, before blogs.php). I guess it parse the request and use the blog shortcut (e.g. david) to find the blog ID and then, query the database to find the post and redirect the files requests to a system directory.

I have downloaded and configured my Cherokee + MySQL + PHP5 + Wordpress 3.1.2 and it works perfectly (GREAT!) but I can't access the blogs because I don't know how to replicate this .htaccess in my Cherokee Virtual Server... :(

Someone with the same problem? Any help would be warmly welcomed and appreciated !!!

Regards,
David

This is the file:

RewriteEngine On

RewriteBase /blog/

 

#uploaded files

RewriteRule ^(.*/)?files/$ index.php [L]

RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

#RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L

RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

 

# add a trailing slash to /wp-admin

RewriteCond %{REQUEST_URI} ^.*/wp-admin$

RewriteRule ^(.+)$ $1/ [R=301,L]

 

RewriteCond %{REQUEST_FILENAME} -f [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule . - [L]

RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]

RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

RewriteRule . index.php [L]

 

<IfModule mod_security.c>

<Files async-upload.php>

SecFilterEngine Off

SecFilterScanPOST Off

</Files>

</IfModule>

_______________________________________________
Cherokee mailing list
Cherokee <at> lists.octality.com
http://lists.octality.com/listinfo/cherokee
Tony Zakula | 7 May 15:06 2011
Picon

Re: Problems migrating Wordpress MU from Apache to Cherokee (Rewrite help needed)

Hi David,

You need to take those WP redirects and put them into the Cherokee
control panel.  They may take some tweaking, but there isn't that
many.  htaccess files are horrible for performance and Cherokee does
not use them.

Hope that helps.

Tony Z

On Sat, May 7, 2011 at 4:27 AM, David Bonilla <david.bonilla <at> gmail.com> wrote:
> Hi there,
> I'm a Cherokee newbie. We are trying to migrate our corporate blogging
> system (an old Wordpress MU, now updated to Wordpress 3.1.2 configures to
> support multiblog). The point is Wordpress uses the Apache's Mod Rewrite to
> manage the multiblog system.
> When you type http://www.yoursite.com/blog/david, Wordpress redirect the
> request to a terrific PHP script (now ms-files.php, before blogs.php). I
> guess it parse the request and use the blog shortcut (e.g. david) to find
> the blog ID and then, query the database to find the post and redirect the
> files requests to a system directory.
> I have downloaded and configured my Cherokee + MySQL + PHP5 + Wordpress
> 3.1.2 and it works perfectly (GREAT!) but I can't access the blogs because I
> don't know how to replicate this .htaccess in my Cherokee Virtual Server...
> :(
> Someone with the same problem? Any help would be warmly welcomed and
> appreciated !!!
> Regards,
> David
> This is the file:
>
> RewriteEngine On
>
> RewriteBase /blog/
>
>
>
> #uploaded files
>
> RewriteRule ^(.*/)?files/$ index.php [L]
>
> RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
>
> #RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L
>
> RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
>
>
>
> # add a trailing slash to /wp-admin
>
> RewriteCond %{REQUEST_URI} ^.*/wp-admin$
>
> RewriteRule ^(.+)$ $1/ [R=301,L]
>
>
>
> RewriteCond %{REQUEST_FILENAME} -f [OR]
>
> RewriteCond %{REQUEST_FILENAME} -d
>
> RewriteRule . - [L]
>
> RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
>
> RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
>
> RewriteRule . index.php [L]
>
>
>
> <IfModule mod_security.c>
>
> <Files async-upload.php>
>
> SecFilterEngine Off
>
> SecFilterScanPOST Off
>
> </Files>
>
> </IfModule>
>
> _______________________________________________
> Cherokee mailing list
> Cherokee <at> lists.octality.com
> http://lists.octality.com/listinfo/cherokee
>
>
Voltron | 7 May 15:13 2011

A few questions

Question one: Failed source handling

I have 3 Vhosts, each with 2 Python backend sources for load
balancing. I noticed that when 1 source misbehaves, and Cherokee emits
errors like this:

{'type': "warning", 'time': "27/04/2011 09:16:47.358", 'title':
"Sources exhausted: re-enabling one.", 'code': "balancer_round_robin.c:
122", 'error': "64", 'description': "All the Information Sources have
been off-lined. ....

It takes the whole server down, which is terrible. Every source lives
in its own environment, why should 1 take down 3 domains, the default
host and 5 other innocent sources?

How can I configure Cherokee to continue to "live" even though a
source is misbehaving?

Question two: Cherokee admin

I noticed, for several versions back now, that Cherokee-Admin does not
consequently detect when Cherokee is up or down. It is very bothersome
that Upstart on Ubuntu 10.04 64 bit brings Cherokee automatically back
on and the status is not detected by the admin. I make my changes, try
to restart and get errors that another server is using port 80. I have
to stop Cherokke admin, kill the newly started Cherokee worker
process, restart Cherokee-Admin just to save my changes and restart.

Is there a way to set the status polling to a higher value in Cherokee-
Admin?

Question 3: Wildcard matching

I would like to match a domain like this "http://mydomain.com" or
"www.mydomain.com". I put "*.mydomain.com" as the wildcard value, this
works but does not match "http://mydomain.com".

Can someone tell me what I am doing wrong?

My system is an Ubuntu 10.04 64bit server with the latest Cherokee

Thanks

Gmane