logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: 40 million hits per day on a cheap $10 vps :)
Author
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Fri 29 May '15 20:17    Post subject: 40 million hits per day on a cheap $10 vps :) Reply with quote

Here is an interesting article about tuning high performance server running on a cheap vps.

The author serves 40 million hits per day on a $10 vps.

http://reviewsignal.com/blog/2014/06/25/40-million-hits-a-day-on-wordpress-using-a-10-vps/

Here is Github repo for this server:
https://github.com/kevinohashi/WordPressVPS
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Sat 30 May '15 16:27    Post subject: Reply with quote

Does apache have such a microcache?
Or is it possible to utilize this when running Nginx in front of Apache?
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Sun 31 May '15 1:24    Post subject: Reply with quote

Apache doesn't have microcache that I know of, however there is Apache Traffic Server which is high performance caching proxy reverse and forward, but it requires a separate installation http://trafficserver.apache.org/ .

There are also Apache caching modules.
http://httpd.apache.org/docs/2.4/caching.html
https://www.digitalocean.com/community/tutorials/how-to-configure-content-caching-using-apache-modules-on-a-vps

And we also have simple caching tricks with headers and .htaccess however those are client side caching methods. http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html


Last edited by jimski on Sun 31 May '15 3:48; edited 1 time in total
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Sun 31 May '15 3:48    Post subject: Reply with quote

And also stuff like http://httpd.apache.org/docs/2.4/mod/mod_socache_memcache.html
Back to top
covener



Joined: 23 Nov 2008
Posts: 55

PostPosted: Sun 31 May '15 7:12    Post subject: Reply with quote

jimski wrote:
Apache doesn't have microcache that I know of, however there is Apache Traffic Server which is high performance caching proxy reverse and forward, but it requires a separate installation http://trafficserver.apache.org/ .


There doesn't appear to be anything more to "microcache" then "pretend the response is cacheable for a short time and cache it" which Apache can do just fine.
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Sun 31 May '15 14:32    Post subject: Reply with quote

covener wrote:
There doesn't appear to be anything more to "microcache" then "pretend the response is cacheable for a short time and cache it" which Apache can do just fine.

How can this be done in Apache? I would like to know how to configure this.
Back to top
C0nw0nk



Joined: 07 Oct 2013
Posts: 241
Location: United Kingdom, London

PostPosted: Sun 31 May '15 17:49    Post subject: Reply with quote

I don't mean to blow any posts out of the water or cause problems but a over hyped $10 vps even though the web server itself could support 40million hits and php could also serve that much traffic bandwidth is not cheap and neather are resources nor consumption of cpu/ram if their vps is in a virtual enviorment it would cost allot more than $10 a month to persistently serve that amount of traffic on a daily basis.

I am aware of digitalocean and even with a cheaper service than digitalocean it would still eat up your bandwidth and the cost of bandwidth would be the sum of money they have forgoten to mention.

A service i tested was called runabove.
https://www.runabove.com/

Does everything the same as digitalocean but prices are cheaper perhaps someone should start digging and see just how much money has been missed out in bandwidth expenses.

Digital ocean has 2TB bandwidth on their $10 VPS and then Additional bandwidth transfer is only 2¢ per GB.

RunAbove has 5TB bandwidth on their $9 VPS and then Additional bandwidth transfer is only $0.01/GB.

But if you take that ammount and do the maths on the cost of sustating that amount of traffic for a entire month alone you will be slapped with a big bill.

I do not like to see blog posts that manipulate/miss out crucial details such as this that blog post seems more like a marketing scheme for digitalocean. (Makes them sound good until the user sees the bill he recieves and wishes he had gone elsewhere or instead picked up a dedicated machine.)


Last edited by C0nw0nk on Mon 01 Jun '15 4:10; edited 3 times in total
Back to top
covener



Joined: 23 Nov 2008
Posts: 55

PostPosted: Sun 31 May '15 18:05    Post subject: Reply with quote

gijs wrote:
covener wrote:
There doesn't appear to be anything more to "microcache" then "pretend the response is cacheable for a short time and cache it" which Apache can do just fine.

How can this be done in Apache? I would like to know how to configure this.


Isn't it just a basic mod_expires+mod_cache configuration? The fudge is that you pretend most of your dynamic content is cacheable for a small window of time even if it's not at all cacheable.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 01 Jun '15 16:28    Post subject: Reply with quote

covener wrote:

Isn't it just a basic mod_expires+mod_cache configuration? The fudge is that you pretend most of your dynamic content is cacheable for a small window of time even if it's not at all cacheable.


That is true.
The link that jimski posted with cache in memory is nice.
Another thing that I do sometimes on busy pages is parital cache of a page. Cache most of the generated page in memory or disc in static files and generate each time only the content that needs to be dynamic.
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Mon 01 Jun '15 22:19    Post subject: Reply with quote

Another thing that I've recently tried was Ramlog.
http://www.tremende.com/ramlog/

I use Ramlog for access logs and then I flash them to disk every 30 minutes with "reload".

I'm about to try bcache though on Centos 6.6 it requires kernel upgrade and some hacking.
http://bcache.evilpiepirate.org/

Although those are not Apache caching methods, they do improve server performance a lot. Ramlog can be used on a VPS but bcache is really not applicable to DigitalOcean virtual machines.


covener wrote:

Isn't it just a basic mod_expires+mod_cache configuration? The fudge is that you pretend most of your dynamic content is cacheable for a small window of time even if it's not at all cacheable.

I'm not sure if I understand what you mean by "not at all cachable". On Nginx, microcache will cache the content for a short period of time on the server side. This does not affect the header settings that control the browser side caching and expiration. If you force the headers with mod_expires to a shorter value it will affect the browser side caching as well, won't it ?

Also main difference between Nginx microcache and Apache caching modules is that on Nginx most of the high performance options are part of the Nginx core and don't require any modules. This makes a huge performance difference when it comes to using Nginx as a caching proxy. It will literally run circles around Apache no matter how many modules you plug in.


C0nw0nk wrote:
I don't mean to blow any posts out of the water or cause problems but a over hyped $10 vps even though the web server itself could support 40million hits and php could also serve that much traffic bandwidth is not cheap...

Conwonk is right, I don't know if DigitalOcaean applies a penalty for bandwidth use but many hosting companies do that. Even though some advertise "Unlimited Bandwidth" the moment your real usage goes over certain threshold they will cancel your account or ask you to pay more. I had this experience with GoDaddy hosting. They shut down my vps without a notice claiming that my server is disrupting operation of other servers on the same host, and I was serving only a million pages per day Smile.

Hey Conwonk are you hosting your site on VPS servers. If so how many GB of traffic and page views do you have and how many VPSs do you need to serve your traffic?


Last edited by jimski on Tue 02 Jun '15 21:53; edited 1 time in total
Back to top
C0nw0nk



Joined: 07 Oct 2013
Posts: 241
Location: United Kingdom, London

PostPosted: Tue 02 Jun '15 8:30    Post subject: Reply with quote

I use dedicated machines and i use a primary loadbalencing IP to redirect of to other servers they all comunicate with eachother accross a internal network (ethernet cables connecting each machine to eachother).

All my machines have a 1GBPS port but now obviously serving high traffic multimedia content one machine would never take it all what is why you loadbalance accross them all making my average output about 20GBPS and daily traffic of a single site on those machines alone is over 10million hits.

Another reason why Nginx is suitable formy needs in this was because of the peseudo streaming ability that is built into it that is not included with apache and the fact that i am not limited to 1000 concurrent connections with nginx like i am with apache. If you are dealing with high traffic on windows you either need a custom built apache or to drop it all together and move onto something that will take your traffic.

So for anyone who is looking to achieve like this topic states 40million hits a day in apache instead of nginx i suggest you keep on dreaming because that concurrent connection limit will hold you down, You cant serve allot of traffic if your server is limiting your number of connections.

Also be prepared for the monthly fee's mine cost me between £1-2K per month because of bandwidth.

But if you was looking for a vps that would take the traffic and is better than digitalocean also cheaper i highly recommend runabove.com im pretty sure the max bandwidth output you can have of a single vps with them is 1TBPS or 10TBPS im sure if you google you will find the exact value of that. All you have to do is compare disk sizes and hardware with digitalocean and you will see runabove gives you more for your money what is why i tested them in the first place. But its cheaper to just go dedicated for high traffic enviorments than to use these virtual machines. As the small print says $0.01 per GB of bandwidth extra used there is a catch. and that was it you will find it more expensive on a virtual enviorment than you would on a dedicated or better yet build and buy your own machines and colocate to a datacenter.
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Tue 02 Jun '15 10:44    Post subject: Reply with quote

C0nw0nk wrote:
All my machines have a 1GBPS port but now obviously serving high traffic multimedia content one machine would never take it all what is why you loadbalance accross them all making my average output about 20GBPS and daily traffic of a single site on those machines alone is over 10million hits.

Let me see if I understand, so you connect a bunch of 1Gb/s machines to a 20Gb/s switch and then you feed 20Gb/s to the balancer. What switch are you using and what server and network cards on the balancer to handle 20Gb/s load.

Also what storage hardware do you use for the videos and how are your webservers connecting to the storage, are you using windows 2012 virtual storage, disk mapping, iSCSI or NFS or maybe something else?

In my system I use LSI Megaraid with SAS expander and a 14 disk RAID 6 with CacheCade on SSD to accelerate everything. And my webservers are connecting to it through NFS. However I'm about to replace RAID 6 with RAID 10 because it is faster to deploy and takes much less time to rebuild in case of disk failure. And my storage servers have 4 x 1Gb/s ports aggregated to a layer 3 switch.
Back to top
C0nw0nk



Joined: 07 Oct 2013
Posts: 241
Location: United Kingdom, London

PostPosted: Tue 02 Jun '15 13:06    Post subject: Reply with quote

Instead of trying to explain it because my description skills are awful i think i will put together a picture and just link you to it to help you understand because i feel like i will make a mountin out of a mole hill if i try explaining it. (Shall also include hardware details)
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Tue 02 Jun '15 21:10    Post subject: Reply with quote

Yes, please include hardware details. Thank you.
I will send you my configuration. I have a setup using 8 hardware servers and 3 virtual machines for serving my websites. My biggest challenge right now is scaling storage server and Postgres database.

There are many smart guys on this forum but so far you are the only one I know that is running an application of this size and with those load parameters on windows. I launched a couple of sites with 1 million hits per day and I know how much work it takes.


Last edited by jimski on Fri 31 Jul '15 16:34; edited 2 times in total
Back to top
covener



Joined: 23 Nov 2008
Posts: 55

PostPosted: Thu 04 Jun '15 22:40    Post subject: Reply with quote

jimski wrote:
If you force the headers with mod_expires to a shorter value it will affect the browser side caching as well, won't it ?


Yes, that approach would end up in the response in that case, an alternative would be something like CacheDefaultExpire instead which does not add actual headers. Yet another option would be setting headers for shared caches only.

jimski wrote:

Also main difference between Nginx microcache and Apache caching modules is that on Nginx most of the high performance options are part of the Nginx core and don't require any modules. This makes a huge performance difference when it comes to using Nginx as a caching proxy.


To me, that seems extremely unlikely to be a "main difference". Maybe it's one of the easy to understand differences laymen talk out to contrast the two servers, but it's not the source of the performance or scaling characteristics by any stretch of the imagination.

There are all sorts of proxies with varying performance characteristics that use a broad variety of programming models and module APIs that you can pick from.

It's far from the most interesting aspect for performance or scalability.
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Mon 08 Jun '15 8:09    Post subject: Reply with quote

covener wrote:
Yes, that approach would end up in the response in that case, an alternative would be something like CacheDefaultExpire instead which does not add actual headers. Yet another option would be setting headers for shared caches only.


Instead of trying to rig a microcache wannabe on apache, I think a much better solution for a busy website serving php would be to compile index php page into a static html and then serve other php pages with normal caching modules. And in this case the static precompiled html can be even served from CDN. I have done this before and it worked well. This of course won't work for pages that continuously change unless you run some insane cron job to recompile the pages on every change.
Back to top
covener



Joined: 23 Nov 2008
Posts: 55

PostPosted: Mon 08 Jun '15 15:47    Post subject: Reply with quote

jimski wrote:

Instead of trying to rig a microcache wannabe on apache


Are you saying an nginx "microcache" is more sophisticated then this? The previously linked doc seemed to be the same thing -- pretend php resources are cacheable for a short time. Can you share any more info?
Back to top
jimski



Joined: 18 Jan 2014
Posts: 196
Location: USSA

PostPosted: Tue 09 Jun '15 10:40    Post subject: Reply with quote

covener wrote:
Are you saying an nginx "microcache" is more sophisticated then this? The previously linked doc seemed to be the same thing -- pretend php resources are cacheable for a short time. Can you share any more info?

Yes, nginx cache in general, not just microcache, is much more sophisticated because it can take advantage of nginx core scripting statements and if desired Lua scripting, as well as other nginx facilities. Take a look at this config as an example of what can be done.

# If non GET/HEAD, don't cache & mark user as uncacheable
# Bypass cache if no-cache cookie is set
# Bypass cache if flag is set
# Only cache valid HTTP 200 responses for 1 second
# Set files larger than 1M to stream rather than cache
# And much more...

https://gist.github.com/fennb/1283573
Back to top


Reply to topic   Topic: 40 million hits per day on a cheap $10 vps :) View previous topic :: View next topic
Post new topic   Forum Index -> Apache