Thursday, June 25, 2009

Re: cakephp project scaling, load balancing problem by using xampp linux on centos

Would it be possible to use database session storage in your
application instead? There are two configuration changes that need to
be made in your app/core.php file, and one table that needs to be
created in your database. The rest should happen automagically.

I've found that with load-balanced app servers, database storage for
sessions causes less headaches than whatever HAProxy/Apache Proxy +
sticky sessions can offer at the cost of a few additional SQL queries.
However, it the benefits would largely be dependent on your
application structure & current bottlenecks.

-J.

On Jun 24, 12:18 pm, wangchao <yaserw...@gmail.com> wrote:
> Hi all,
>
> I am not sure whether this problem is quite related to cakephp. But I
> think here is a good place to ask for help. So I am very appreciate if
> anyone could help me or give me any advices. If anyone met similar
> problem, I will be very glad if we can discuss together.
>
> Ok. Just breifly talk about my objective. I have a web app which is
> built based on cakephp. Due to some reasons, I would like to add
> another web server which will be running an identical web app and a
> load balancer to dispatch the requests.
>
> Environment:
> All the things are running on different virtual machines
> CentOS 5.3
> XAMPP - Linux 1.7.1
>   - only run apache on two web servers
>   - only run mysql on database server
>   - only run apache on load balancer
>
> Next is the configurations:
> IP address:
>   - web server 1 : 10.10.77.222
>   - web server 2 : 10.10.77.223
>   - db server : 10.10.77.226
>   - load balancer: 10.10.77.123
>
> And I modified the httpd.conf on the load balancer. I add the
> following configurations:
>
> <IfModule proxy_module>
>   ProxyRequests Off
>   <Proxy *>
>     AddDefaultCharset off
>     Order deny,allow
>     Allow from all
>   </Proxy>
>
>   ProxyVia On
> </IfModule>
>
> <Location /balancer>
>   SetHandler balancer-manager
>   Order deny,allow
>   Deny from all
>   Allow from 10.10
> </Location>
>
> <Location /status>
>   SetHandler server-status
>   Order deny,allow
>   Deny from all
>   Allow from 10.10
> </Location>
>
> <Proxy balancer://mycluster>
>   # cluster member 1
>   BalancerMemberhttp://10.10.77.222:80route=ws1
>   # cluster member 2
>   BalancerMemberhttp://10.10.77.223:80route=ws2
>
> </Proxy>
> ProxyPass /balancer !
> ProxyPass /status !
> ProxyPass / balancer://mycluster/ lbmethod=byrequests
> # I am not using sticky session here because the sessions are stored
> in the database.
>
> ProxyPassReverse /http://10.10.77.222/
> ProxyPassReverse /http://10.10.77.223/
>
> ExtendedStatus On
>
> After that, I start apaches, type in the load balancer's ip address in
> my browser. The main page shows up and it works well. But there is
> something wrong. I cannot login to the app anymore. I think there
> maybe something wrong with the session but i am not sure.
>
> I also tried with a sticky session, but it seems like the same
> problem. I just add a RewriteRule on each web server. It looks like
> RewriteRule .* - [CO=PHPSESSID:balancer.ws1:10.10.77.123]. It is
> possible that I have a wrong configuration. I will be very glad if
> anyone can correct me.
>
> The tutorials I referred are:
>   - Apache mod_proxy balancing with PHP sticky sessions
> (http://www.markround.com/archives/33-Apache-mod_proxy-balancing-with-
> PHP-sticky-sessions.html)
>
>   - scaling drupal step two - sticky load balancing with apache
> mod_proxy
> (http://74.125.153.132/search?
> q=cache:UKApdy_DQMgJ:www.johnandcailin.com/blog/john/scaling-drupal-
> step-two-sticky-load-balancing-apache-modproxy+apache+load+balancer
> +configuration&cd=10&hl=en&ct=clnk&gl=sg)
>
> If anyone needs some more information, pls feel free to ask. Much
> appreciate you helps.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: