News for hackers. Stuff that matters.

Can Nginx servers scale to the level of Google

Google uses millions of servers around the world to distribute their load in an even manner, and the servers are custom Google servers instead of standard ones like Apache or Nginx. Average Google load is around 40,000 queries per second, translating to 3.7 billion searches per day and 1.2 trillion queries per year. This of course also includes peak load moments like election results being announced somewhere or some game scores being updated. Is Nginx, which is open sourced and freely available, capable of handling such load (of course with right hardware wired to it)? Or is there something inherently lacking in Nginx or Apache or other servers that Google had to settle for a custom home-made server to handle its traffic? Can a series of Nginx servers distributed around the world at opportune places provide similar level of performance for a website of traffic at the level of Google?
( 18 comments | 2 points | on HN )
Re:Can Nginx servers scale to the level of Google by bosch_mind on Friday January 27, 2023 @09:56PM (#34554651)
Cloudflare used NGINX up until recently and that would be Google scale IMO
Re:Can Nginx servers scale to the level of Google by donboscow on Friday January 27, 2023 @09:59PM (#34554667)
Good to know. Any idea why Google chose to use custom servers instead of opting for Nginx or Apache? Specially when Nginx offers excellent load balancing capabilities in-built?
Re:Can Nginx servers scale to the level of Google by detaro on Friday January 27, 2023 @10:01PM (#34554685)
Because their own can solve their problems better. Note that the Cloudflare reference is "used to" - just because you can use nginx at scale doesn't mean it's the best, and all such deployments aren't running stock nginx, and not nginx alone.
Re:Can Nginx servers scale to the level of Google by donboscow on Friday January 27, 2023 @10:03PM (#34554698)
Got it. Thanks. Which servers are best suited to handle such high levels of load, and are available for free and open usage like Nginx or Apache is? I read that Apache has even more problems than Nginx.
Re:Can Nginx servers scale to the level of Google by bosch_mind on Friday January 27, 2023 @11:40PM (#34555211)
Nothing wrong with NGINX. Read Cloudflare post on Pingora.

Different needs for different usecases where NGINX is more of an OOTB situation. NGINX is great. I see Caddy mentioned quite a bit, believe it’s written in Go where NGINX is written in C. Cloudflare wrote Pingora in Rust IIRC and I want to say they are releasing an open source flavor

Re:Can Nginx servers scale to the level of Google by donboscow on Saturday January 28, 2023 @12:24AM (#34555416)
Hmm I read the post. Cloudfare handles almost 1 trillion requests per day, Google does that per year. However, the request types are different, Cloudfare handles a variety of requests like caching and forwarding, while Google requests are about serving complete web pages. May be for the webserver purpose like Google Nginx may suffice?
Re:Can Nginx servers scale to the level of Google by ngetchell on Saturday January 28, 2023 @09:09AM (#34557652)
I'm sorry but those numbers can't be right. Google Analytics is embedded in enough sites to hit a trillion hits a day.
Re:Can Nginx servers scale to the level of Google by bosch_mind on Saturday January 28, 2023 @04:44PM (#34562293)
Cloudflare serves web pages bro because they proxy the bytes between servers from origin to eyeball
Re:Can Nginx servers scale to the level of Google by donboscow on Friday January 27, 2023 @10:00PM (#34554677)
TBH, looks like Nginx has bunch of issues: https://www.youtube.com/watch?v=QbOAHkaFU6w&ab_channel=Husse...
Re:Can Nginx servers scale to the level of Google by infamouscow on Friday January 27, 2023 @10:15PM (#34554764)
Nginx is not going to be your bottleneck. If it is, you don't need to be asking on here. :)
Re:Can Nginx servers scale to the level of Google by cpach on Saturday January 28, 2023 @09:21AM (#34557729)
We don’t all work directly with megascale systems. It can still be interesting to learn about how those systems work, and what considerations need to be made in those circumstances.
Re:Can Nginx servers scale to the level of Google by uaas on Saturday January 28, 2023 @02:46AM (#34555979)
Can you link sources for those Google numbers? I am asking because I have seen smaller platforms, but still with millions of users, and the avg. RPS was around 10-15k.

Nginx is quite scalable with the right configuration and hardware, but most of the times you want to use more instances of it to scale to this kind of traffic.

Modern, Envoy based proxies are quite popular, and can scale better with better performance, mostly due to the fact it’s written in C++.

Re:Can Nginx servers scale to the level of Google by jstx1 on Saturday January 28, 2023 @03:38AM (#34556166)
What do Google (or Facebook) actually use at their scale?
Re:Can Nginx servers scale to the level of Google by ThePhysicist on Saturday January 28, 2023 @04:02AM (#34556259)
If you serve static documents a single powerful server can easily handle 40,000 requests per second (I think now it's more like 100,000 queries per second for Google, BTW). So I don't think the web server is the bottleneck here, it's the complex backend system that answers the queries. Regarding Google scale, I think you can achieve that with almost any software stack, as the scaling doesn't happen on the level of the web server. You have mechanisms like anycast, DNS load balancing etc. that can distribute load to multiple data centers (DC), and within a data center you can use load balancing on layer 4 (TCP/UDP) to distribute incoming traffic to a fleet of different servers. I guess at that scale the consideration which stack to use is more driven by overall cost, i.e. if you can reduce your server count by 90 % by switching to a more performant stack that will dictate your technology choice. Also, under really heavy load I'd say it's more likely that other central components in your DC like your core switch will be the bottleneck, as you can't really scale those horizontally.
Re:Can Nginx servers scale to the level of Google by arter4 on Saturday January 28, 2023 @04:54AM (#34556461)
Probably yes.

You can scale horizontally with a lot of web servers and load balance them. You don't need to stretch load balancer clusters across AZs/regions, so I see no reason why Nginx wouldn't work.

I assume at that scale session cookies are shared without application server clustering. A distributed KV store is probably enough.

Re:Can Nginx servers scale to the level of Google by donboscow on Sunday January 29, 2023 @05:25PM (#34573415)
Hi, I thought so too. But then why did it not work for Cloudflare, and why did their custom solution work with Pingora?
Re:Can Nginx servers scale to the level of Google by arter4 on Monday January 30, 2023 @02:02PM (#34584769)
As it turns out, they didn't like that each requests lands on a single worker and can only reuse connections on that worker, which gets worse as the number of workers per server increases. Presumably, scaling horizontally wasn't cost efficient enough.

They also wanted something written in a memory-safe language so it could be extended without easily falling into memory safety issues. NGINX is written in C.

Re:Can Nginx servers scale to the level of Google by muzani on Saturday January 28, 2023 @10:17AM (#34558220)
Pornhub uses nginx and it's a top 5 website in traffic.

Source: https://davidwalsh.name/pornhub-interview