Re: Please help me out !

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tamer,

The usual set up is a load balancer at the front end, multiple webservers
and one (or more) mysql server. Personally, I prefer a primary mysql server
with a failover to a standby machine for when the primary goes down but
that depends on budget and resources available.

The real tricks with the load balancer are to :

- pass the X_HTTP_FORWARDER header to ensure that you get the user's IP and
not the IP of the load balancer.

- decide how you are running sessions, using sticky or not sticky sessions.
Sticky sessions will always direct the user to the same webserver so that
session data doens't need to be replicated. Non-sticky sesssions usually
store the session data in the DB or a location that can be accessed from
all web servers. Non-sticky sessions are better when using RESTful apps.

There usually isn't a ton of special coding that you need to do. The main
aspect will be handling session related data, unless you don't use
sessions.

For the most part, the infrastructure handles the additional equipment, you
code pretty much like you normally do. You still need to make the same
choices as when you have an app on a single server.

- restful vs stateful
- sesssions handling
- mysql (usual is to write to a single master server, read from
replicant(s))

To put things in context, I've written apps that worked with 6 webservers
talking to a single mssql instance and wordpress apps that worked with 38
webservers talking to two mysql instances.

HTH

Bastien


On Tue, Dec 16, 2014 at 10:41 AM, TR Shaw <tshaw@xxxxxxxx> wrote:
>
>
> On Dec 16, 2014, at 10:29 AM, Aziz Saleh <azizsaleh@xxxxxxxxx> wrote:
>
> > On Tue, Dec 16, 2014 at 12:30 AM, Tamer Kadmany <
> gaiatamerkadmany@xxxxxxxxx>
> > wrote:
> >>
> >> Hello
> >>
> >>
> >>
> >> Please hear me and try to help me out,
> >>
> >>
> >>
> >> I am a PHP programmer, I know PHP for websites that can be hosted on one
> >> server
> >>
> >> Buy I don't know how to work with PHP on website that has more than one
> >> server
> >>
> >> So I am trying to find out where I could learn about all the subjects
> that
> >> are related to
> >>
> >> Building a large web application - a website that has multiple servers
> and
> >> doesn't rely one one server only
> >>
> >> The reason behind this is that one server written with PHP will likely
> go
> >> down if number of users exceeds the limit
> >>
> >> So I don't know what to do, where I can learn all the subjects
> >> (PHP,DATABASE,THE RIGHT DESIGN ETC ..)that are related to that
> >>
> >> Do you know what eBooks out there or web links or any source of
> information
> >> that can help ?
> >>
> >> Websites like facebook,twitter,reddit, are built like that, how could I
> >> learn that ?
> >>
> >>
> >>
> >> Please do your best effort to help me out, I have a cool idea that I
> want
> >> to
> >> develop,
> >>
> >> Thank  you !!!
> >>
> >>
> >>
> >> " Building a large web application - a website that has multiple servers
> > and
> > doesn't rely one one server only"
> >
> > Usually from my understanding there are 2 different types of scaling. One
> > to scale the structure, which still relies on all structures to operate
> and
> > one mirroring the DNS for the same exact website.
> >
> > You can google "how to scale websites" to see how people are doing it,
> note
> > that scaling a website out has nothing to do with the language (the same
> > way you scale php/mysql you can scale asp/sql), you just need to study
> and
> > figure out which parts of your system needs to be separated/scaled out
> > (mysql, memcached, files, etc..). Here is a good thread I found with the
> > above search term:
> >
> >
> http://programmers.stackexchange.com/questions/1280/what-should-i-do-to-scale-out-a-high-traffic-website
> >
> > Hope it help!
>
>
> Don't forget to readup on mySQL's replication capabilities.
>
> you need to also design in the ability to gracefully bring down and back
> up including syncronizing databases before accepting http traffic.
>
> Tom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 

Bastien

Cat, the other other white meat

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux