3 ms·
Our main proxies (that do the majority of the heavy lifting over here) run nginx and use, what, 50MB tops? If even? I throw them on $5/mo VPS instances and they
by kyledrake 10y ago
Our main proxies (that do the majority of the heavy lifting over here) run nginx and use, what, 50MB tops? If even? I throw them on $5/mo VPS instances and they just blast out IO without any problems.
But nginx was carefully written in C over the course of many years, with a general goal of hauling IO and static data around from other systems. Which is all you really need for web pages, in the end. Solved one thing and holy crap they did it well.
It's the business logic side of the web development world where things get nasty. The tradeoff is you get a giant chest of libraries for solving any stupid problem you want. I didn't have to for example figure out how to do IDN encoding for domain validation. You throw enough of that crap together in a single process and things start to get nasty. But how long would I have spent carefully writing all of it in C? Let's just say I'd be out looking for another job.
Worth the tradeoff, IMHO, but I think with projects like Crystal (https://crystal-lang.org https://crystal-lang.org) in the future we will discover we can get pretty close to both in the end. That combined with Moore's law and I think we'll be good to go.
Assuming, of course, that cloud providers don't artificially restrict available RAM through economic constraint (know the true costs - demand better!).
- mikekchar 10y agoI realised (thanks to the other poster) that my comment may have seemed dismissive, which was not my intent. Just marvelling at it myself :-) But I do wonder about this kind of stuff. I have been wrestling with some legacy systems chewing up gobs and gobs of memory lately. Then wrestling with my own code that was chewing up gobs and gobs of memory :-) It's pretty easy to make mistakes because we don't really get punished, as you say. But I wonder if we might be doing ourselves a disservice by not restricting ourselves. Generally speaking, better code is better and while it often feels slower to write, my experience has been that it doesn't always work out that way. I might try working in a memory restricted container to see if it improves my code...
- iopq 10y agoAnother thing to look into is to write things in Rust. It will be as fast as C code, but a little nicer to work with. Right now the problem with that is that you don't have the nice libraries for whatever you're doing. But if people actually wrote fast Rust libraries for everything, they're as easy to embed into your apps as C.
- pjmlp 10y agoBut one thing that people keep forgetting is that even 50 MB would be a dream to any user on the old Xerox PARC workstations. So it is mostly an issue of sloppy coding and bad GC implementations than anything else.
- lmm 10y agoIf you don't want to wait for Crystal to mature there's a long line of high-level languages with similar performance characteristics - check out OCaml or Haskell, or perhaps F# or Scala (if it's throughput you need rather than fast startup).