Live data from Hacker News

My £4 a month server can handle 4.2M requests a day

mark.mcnally.je

441–450 of 479 posts

Re: My £4 a month server can handle 4.2M requests a day

#441

One of my proudest moment in my career is when I lowered our app processing time from ~8hrs to 17 minutes. When I deployed my first update, it reduced it to 2 hours. The sysadmin immediately contacted me that there was something unusual. I confirmed the results but he was skeptical. Then with my second update, he told me that the app must be broken or that the script must be dying. There is no way it could complete t…

I had a similar experience as a intern years ago! Part of my daily responsibility was to manually enable/disable API integrators who had increased levels of traffic as it would take the API down for all partners. Pretty bad. Thousands of requests at peak would bring the server to its knees.

Until I worked out during some minor maintenance task that every request was logged to a flat file. Appended. Every request. The file was probably 100gb by the time I found it and every request log would lock the logging file. The server had been running for a couple of years by that time.

Of course I screwed up more than I fixed. :D

Re: My £4 a month server can handle 4.2M requests a day

#442
post #419

Earlier quoted context omitted.

I just really wanted to launch my software. Which when I began coding it, seemed completely legal and possible in Costa Rica. As the laws started to change - and even before Bitcoin came on the scene - I looked for how to do it without running afoul of anything. So it's not like I set out with a plan to exploit all the legal loopholes in the world, I just adapted my code and split it apart as necessary. I never even…

> I just really wanted to launch my software. Come on. Cut the bullshit. > Which when I began coding it, seemed completely legal and possible in Costa Rica. As the laws started to change - and even before Bitcoin came on the scene - I looked for how to do it without running afoul of anything. So it's not like I set out with a plan to exploit all the legal loopholes in the world, I just adapted my code and split it ap…

Stop speaking for other people.

Re: My £4 a month server can handle 4.2M requests a day

#443

Earlier quoted context omitted.

He's a frickin genius because he found ways to break the law with impunity for his own profit ? I'm surprised by HN sometimes.

No laws were broken, else they'd be in jail. It's how the big companies that HN worships get away with not paying taxes. Morally dubious? For sure.

> No laws were broken, else they'd be in jail.

Generous to assume that all that break laws go to jail.

Re: My £4 a month server can handle 4.2M requests a day

#444

Earlier quoted context omitted.

Sending multiple queries from your web server will likely put more load on the database server than using a stored procedure. With either technique you are still pulling all the data you need from the DB but with multiple queries instead of a stored procedure you are usually pulling more data than you need with each query and then dropping any rows or fields you’re not interested in. Together with multiple calls over…

>Sending multiple queries from your web server will likely put more load on the database server than using a stored procedure. Lots of people seem to not realize that db roundtrips are expensive, and should be avoided whenever possible. One of the best illustrations of this I've found is in Transaction Processing book by Jim Gray and Andreas Reuters where they illustrate the relative cost of getting data from CPU vs…

Except for open and writing to files, it's about the heaviest action on a backend server.

Re: My £4 a month server can handle 4.2M requests a day

#445

Earlier quoted context omitted.

Are your starting to feel the pressure yet?

My blog is fine, my self hosted analytics (on another server) not so much!

Do you know what the peak requests per second was?

Re: My £4 a month server can handle 4.2M requests a day

#446

When I launched my former bitcoin casino in 2011 (it's gone, but it was a casino where all games, even roulette tables were multiplayer, on a platform built from scratch starting in '08), I handled all web requests through a server in Costa Rica that cost about $6/mo. Where I had a shell corporation for $250/year. Once the front end -- the bullet containing the entire casino code, about 250kb -- loaded, from Costa Ri…

[deleted]

Re: My £4 a month server can handle 4.2M requests a day

#447
post #294

Earlier quoted context omitted.

I work in the Analytics space and been mostly on Java and I am so glad that other people feel the same. At this point, people have become afraid of suggesting something other than Spark. I see something written in Rust to be much better at problems like this. I love the JVM but it works well with transactional workloads and starts showing its age when its dealing with analytical loads. The worst thing is then people…

I guess your company is running on Java and running something else would cost a lot in training, recruiting, understanding, etc. But down the line, defeating the JVM will be understood only by the guy who did it... Then that guy will leave... Then the newcomers will rewrite the thing in Spark 'cos it will feel safer. Rinse-repeat... (I'm totally speculating, but your story seems so true that it inspired me :-)

Some of it is what you mentioned about training and hiring costs that but mostly its this creation of the narrative that it will scale someday in the future. This is usually done by that engineer(s) and they are good at selling so a different opinion is ignored or frowned upon by the leadership.

I have now seen this anti pattern in multiple places now

Re: My £4 a month server can handle 4.2M requests a day

#448
post #68

Earlier quoted context omitted.

An awful lot of professional programmers work in such heavyweight contexts that they don't have a good idea of how fast modern hardware can be. I was talking with an architect at a bank whose team was having trouble getting under a 2-second maximum for page views. They blamed it on having to make TCP requests to other services, and said something like "at a couple hundred milliseconds per request, it adds up quickly!…

I had a discussion with a coworker about something about slow memcpys, that roughly went the same way except... you know, DDR4 RAM has a speed of roughly 40GBps. Also, that "awful" 1MB memcpy is likely all in L3 cache these days. But even if it weren't in cache, we're talking about an operation that takes 50 microseconds (1MB read + 1MB written == 25microseconds + 25 microseconds). Given that modern CPUs have like 16…

For sure. I think keeping one's intuition for systems updated is one of the biggest quests for anybody trying to have a career in tech.

Re: My £4 a month server can handle 4.2M requests a day

#449
post #270

Earlier quoted context omitted.

A good habit when writing unit tests is to use assertNumQueries especially with views. It's very easy even for an experienced developer to inadvertently add an extra query per row: for example if you have a query using only() to restrict the columns you return, and in a template you refer to another column not covered by only() , Django will do another query to fetch that column value (not 100% if that's still the ca…

Sounds like a good habit, yeah. But the fact that an attribute access in a template (which might be quite far removed from the view code) can kick off a db query is an indication there's something a bit too magical about the design. Often front-end developers without much knowledge of the data model or the SQL schema are writing templates, so this is a bit of a foot-gun.

I've wanted a Django mechanism in the past that says "any SQL query triggered from a template is a hard error" - that way you could at least prevent accidental template edits from adding more SQL load.

Re: My £4 a month server can handle 4.2M requests a day

#450

Earlier quoted context omitted.

I work in the Analytics space and been mostly on Java and I am so glad that other people feel the same. At this point, people have become afraid of suggesting something other than Spark. I see something written in Rust to be much better at problems like this. I love the JVM but it works well with transactional workloads and starts showing its age when its dealing with analytical loads. The worst thing is then people…

> I love the JVM but it works well with transactional workloads and starts showing its age when its dealing with analytical loads. This is interesting. Can you elaborate a bit?

Analytical loads deal with very large datasets in the order of terabytes even after you compress them. These workloads dont change much so keeping them in the heap eventually results in long processing pauses because JVM tries to recover this memory. However, in most cases, this data is not meant to be garbage collected. For transactions, once you have persisted the data, it should be garbage collected so the pattern works. There are a lot of other aspects that I can probably think of but the above one is the most important in my mind.
Post reply on HN