5 ms·
Hmmm... 39M requests per month = 15 requests per second. "20.3MM out of 39MM" of those are hitting a cache, leaving 7.2 requests per second that actually need t
by Veratyr 9y ago
Hmmm... 39M requests per month = 15 requests per second. "20.3MM out of 39MM" of those are hitting a cache, leaving 7.2 requests per second that actually need to be run. The article says requests typically take 2.4s but it's a scraping API and many of those seconds are going to be I/O rather than CPU time. Assuming that there's say 1.0s of CPU time used per request, you should only need an average of ~8 cores/hyperthreads for this.
I suspect you could fit this into a pair of dedicated server s from somewhere like OVH or Hetzner for <$150/month (two servers to provision for peak load, which I'm assuming is ~3x as high as the troughs).
Is there any reason why this wouldn't work?
- Aeolun 9y agoIt isn't Serverless, it doesn't use any of the current buzzwords, and you can't run it on the browser side (who doesn't want to run a backend scraping API on the browser), so you'll get zero buy-in from any of the current load of entrepreneurs. I see only negatives, don't think about doing it that way.
- codefined 9y agoAll of your negatives are about the perception of server/serverless, not about the actual benefits. Who knows if this company has investors or if it is actually self funding (judging by the costs, maybe not hard?).
- mgkimsal 9y agoI suspect Aeolun's comment was somewhat sarcastic, no? While there are benefits, the biggest one the OP pointed out was reduced costs. The GP post was pointing out you could still likely achieve the scale the OP posted about for half of what they're paying on traditional hardware.
- MihailBurduja 9y agoThe requests are not uniformly distributed throughout the day, so you can safely triple the calculations you just made.
- mromnia 9y agoYou realize he actually did take that into account, and tripling his estimate is exactly what he did?
- EwanToo 9y agoI'm sure it would work, but you wouldn't get a lot of the benefits like a global distributed cache (API Gateway uses Cloudfront as it's cache), and you're obviously dependant on support from a very low cost supplier in the event of a problem with the hardware. Would it be worth introducing that support dependency for ~$200 a month? Maybe, I guess it depends on what you're making from the service.
- mattmanser 9y agoSo using a CDN? I wouldn't list that as a 'benefit' of a cloud-based solution, anyone can use a CDN.
- cc81 9y agoI guess there will also be some cost reduction if you can skip the server management. You will still have to monitor how your code is doing but no longer have to patch them.
- rtpg 9y agoyou still have to run the cache from somewhere, and you probably want to be able to deploy during peak load times. Not sure about the price, to me $75 for a decently beefy server seems low? Compared to the cheap stuff that most people use because most people are only at like 1 or 2 r/s. Also serverless might sound silly but isn't it nice to not have to do ops works? Surely worth $200/month.
- kogepathic 9y ago> Not sure about the price, to me $75 for a decently beefy server seems low? You can argue whether Hetzner is reputable hosting or not, but $75/month will get you a v3 Xeon with 32GB of ECC RAM. > Also serverless might sound silly but isn't it nice to not have to do ops works? Surely worth $200/month. Hosting something on Amazon doesn't absolve you of operations work, it's just a different kind of operations. Instead of managing the OS/software updates, you need to manage S3, IAM, CloudWatch, optimise time/memory consumption to reduce cost, etc. Maybe we just have different definitions of "ops works" but it bothers me when people claim that you don't need to have anyone minding AWS because it's serverless. You still need to have people monitoring, managing permissions, optimising to reduce cost, pushing updates, etc.
- mgkimsal 9y ago> Maybe we just have different definitions of "ops works" but it bothers me when people claim that you don't need to have anyone minding AWS because it's serverless. You still need to have people monitoring, managing permissions, optimising to reduce cost, pushing updates, etc Thank you. Instead of being able to find a server ops guy from a large pool of experienced folks, you now have to find someone specifically with AWS-ops experience - a growing but much smaller pool of people, ime. Getting IAM permissions correct for complex stuff is just not simple, for example, and there's some use cases IAM stuff doesn't (or didn't) cover. Had a client who couldn't give me EC2 access because - at least at the time - they'd have to give me access to all their EC2 instances, not just the ones I needed. Now... this may have been IAM-inexperience, although, at the time, my digging seemed to indicate it was the correct conclusion.
- deleted 9y ago[deleted]
- RX14 9y agoIt would be my impression that 1s of cpu time used per request is a very very high value for the given problem. Am I incorrect?
- brianwawok 9y agoFor whatever reason lambda cpu time is much slower then test on your laptop time. Something that takes your laptop 5ms may take lambda 100ms. Some may be oversubscription, some could be cache thrashing...
- toomuchtodo 9y agoTakes time to bring the container up to execute.
- Veratyr 9y agoNo, I also suspect it shouldn't use nearly that much CPU time. I just wanted to make sure it was high enough that I wasn't underestimating it.
- tyingq 9y agoThe transactions are likely very peaky though, so it's difficult to map transactions/month to transactions/second without knowing more. For sure, a straight average isn't useful. WordPress is notorious for non-cached requests being very heavy as well. Hundreds of PHP files and database queries for a single page isn't uncommon. And the PHP opcode caches suffer from an avalanche problem at cache expiration.
- ryanackley 9y agoI get about 150/requests/sec on a $25/month google cloud instance. Each request queries or updates a mysql database. The database is about $200/month though. Although the database doesn't break a sweat until about 1000/requests/sec
- dsacco 9y agoYeah...my takeaway from this article is that they shouldn't be using AWS Lambda. If you wanted to go through all of caching and load balancing responsibly you could serve their load for <$100/month.
- Warvick 9y agoThis is some budget thinking, but 20 $5 instances, 10 from Vultr and 10 from Linode in 4 different locations and 2 load balancing servers for tops $30 with DDOS protection etc. to send the requests to proper servers would easily handle this and scale without the problem. Would that work? We would be left with $130 easy to scale, huge bandwidth and computing power network.
- beagle3 9y agoWhat would you use for load balancing, where would you put it and how would you run it (say, DNS wise)? It's been a few years since I looked at it, but I couldn't find a cheap, reliable way to load balance a web app between providers.
- fweespeech 9y agoTbf, AWS can't do that inter-region well either which is effectively what we are talking about. They rely on DNS-based solutions and so do many CDNs.
- toomuchtodo 9y agoEveryone does DNS load balancing unless you're ready to do BGP and announce/withdraw your net blocks based on health. Anycast is nice, but niche.
- ngrilly 9y agoCloudFlare?
- imron 9y agoNope, but how much are you paying the sysadmins?
- Veratyr 9y agoYou don't need a fulltime sysadmin to handle this. If you can't set up the servers yourself, you can set up a contract with a sysadmin for initial setup and ongoing support, which can be billed hourly.