D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Nginx vs. Apache

 

On 11/05/15 21:17, Joseph Bennie wrote:

On 11 May 2015, at 20:53, Simon Waters <simon@xxxxxxxxxxxxxx
<mailto:simon@xxxxxxxxxxxxxx>> wrote:

I'm skeptical of load balancing for databases.

It makes sense if the goal is robustness, although some big services
use other means, like a master/slave model, or just use highly
available hardware configurations, with a single simple MySQL instance.

But the gain from multiple servers is low. With master/master all the
transactions may be effectively being applied to both servers anyway,
so the performance can go down.

In contrast even modest database optimisations can reduce effort by
orders of magnitude. Not done this sort of stuff so much with MySQL,
but I imagine the principles are similar to other relational databases.

Modern servers can handle thousands or tens of thousands transactions
per second.

What sort of stats do you have for the database. Table sizes, index
sizes, transaction mix, cache hit rates etc. if you haven't looked at
this you probably need a DBA not hardware.



I mostly second this, My personal experience of running a pair of
parallel Master-slaves = never a day when it worked right! (v5.0, its
improved apparently), just beef up a server to be the master and have
slave replication for read/redundancy, if you can scale the read
operations then you can get some performance gains, but write should go
via the single master for consistency… and sanity.

chances are if you really have data-io problems your looking in the
wrong place, front side caching is probably more optimal, There are
multiple strategies and you can tune at a URL + params level, something
like 10mins before auto expire can really take a load off.

but guessing your hosting and not in control of that. If that's case you
might want to investigating throttle strategies to mange load, rather
than have your io max out. … if it does add more NIC’s - chances are its
net IO causing the blocking not the internal IO.




Sent from myMail for iOS


Monday, 11 May 2015 19:45 +0100 from Matt Stevenson
<mrmstevenson@xxxxxxxxx <mailto:mrmstevenson@xxxxxxxxx>>:

    Am also thinking about spreading mySQL load over hosts with
    master-master setup if this article can be trusted seems to make
    sense as rsync will probably not handle locked tables with site
    mirroring. So maybe application LB is in order.
    http://brendanschwartz.com/post/12702901390/mysql-master-master-replication
    Is it true nginx is simpler to configure LB ?

    On Monday, May 11, 2015, Matt Stevenson <mrmstevenson@xxxxxxxxx
    <x-msg://e-aj.my.com/compose/?mailto=mailto%3amrmstevenson@xxxxxxxxx>>
    wrote:
    > Thank you Joseph good comments duly noted.
    > Having seen our Centos servers PHP in top running on fire nearly
    all day as it hosts 50 + sites.
    > I’m really curious about running a docker container with NGINX
    as a proxy LB and giving NGINX a trial on a cloud server. Just
    hope I don’t screw anything up in the process and maybe create
    some trial sites first.  ;-)
    >
    > On Monday, May 11, 2015, Joseph Bennie <jay@xxxxxxxxxxx
    <x-msg://e-aj.my.com/compose/?mailto=mailto%3ajay@xxxxxxxxxxx>> wrote:
    >>
    >>> On 11 May 2015, at 18:03, Matt Stevenson
    <mrmstevenson@xxxxxxxxx
    <x-msg://e-aj.my.com/compose/?mailto=mailto%3amrmstevenson@xxxxxxxxx>>
    wrote:
    >>>
    >>> Hey there
    >>>
    >>> Anyone out there managing cloud web servers got an opinion of
    Nginx vs. Apache.
    >>> Performance apparently differs with PHP. We are interested in
    Nginx as a LB to our cloud servers.
    >>> Is this easy and good practise.
    >>>
    >>
    >> I haven’t used nginx, but most alternatives are better than
    stock apache setup when working with php.
    >>
    >> The trade off is if you don’t need thread safe (most people
    don’t , but think they do) then swapping to apache mpm or nginx
    will give better through put and possibly better memory usage. but
    its no panacea, profile (just use ‘top' initially) your php memory
    usage, I recently saw a centos 6 stock apache setup falling apart
    with only 12 paralel active php sessions running.
    >>
    >>> Regards
    >>>
    >>> Matt --
    >>> The Mailing List for the Devon & Cornwall LUG
    >>>http://mailman.dclug.org.uk/listinfo/list
    >>> FAQ:http://www.dcglug.org.uk/listfaq
    >>
    >>
    >> --
    >> The Mailing List for the Devon & Cornwall LUG
    >>http://mailman.dclug.org.uk/listinfo/list
    >> FAQ:http://www.dcglug.org.uk/listfaq
    >>
    --
    The Mailing List for the Devon & Cornwall LUG
    http://mailman.dclug.org.uk/listinfo/list
    FAQ:http://www.dcglug.org.uk/listfaq

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ:http://www.dcglug.org.uk/listfaq



Possibly offtopic but a lot of the problems I've seen with transactions and locking is that often a transaction requires locking (sections of) two tables but can involve 30 or 40 others which are locked too. This is one of the reason distributed databases can be no better than single servers. And transactions that run over several web pages ...
Tom te tom te tom

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq