3 ms·
There is no reason data isolation should cost you 100x memory usage.
by adastra22 2y ago
There is no reason data isolation should cost you 100x memory usage.
- marcosdumay 2y agoThere are plenty of reasons. They are just not intrinsic to the isolation, instead they come from complications rooted deeply on the underlying system. If you rebuild Linux from the ground up with isolation in mind, you will be able to do it more efficiently. People are indeed in the process of rewriting it, but it's far from complete (and moving back and forward, as not every Linux dev cares about it).
- btilly 2y agoUnless you can be concrete and specific about some of those reasons, you're just replacing handwaving with more vigorous handwaving. What is it specifically about JavaScript's implementation of data isolation that, in your mind, helps cause the excessive memory usage?
- marcosdumay 2y agoJust a day or two ago, there was an article here about problems implementing a kind of read-only memory constraint that Javacript benefited from in other OSes.
- btilly 2y agoI must have missed that article. Can you find it? Unless you can come up with a specific reference, it seems unlikely that this would explain the large memory efficiency difference. By contrast it is simple and straightforward to understand why keeping temporary garbage until garbage collection could result in tying up a lot of memory while continually running code that allocates memory and lets it go out of scope. If you search, you'll find lots of references to this happening in a variety of languages.
- chipdart 2y ago> There is no reason data isolation should cost you 100x memory usage. It really depends on what you mean by "memory usage". The fundamental principle of any garbage collection system is that you allocate objects in the heap at will without freeing them until you really need to, and when that time comes you rely on garbage collection strategies to free and move objects. What this means is that processes end up allocating more data that the one being used, just because there is no need to free it. Consequently, with garbage collecting languages you configure processes with a specific memory budget. The larger the budget, the rarer these garbage collection strategies kick in. I run a service written with a garbage collected language. It barely uses more than 100MB of memory to handle a couple hundred requests per minute. The process takes over as much as 2GB of RAM before triggering generation 0 garbage collection events. These events trigger around 2 or 3 times per month. A simplistic critic would argue the service is wasting 10x the memory. That critic would be manifesting his ignorance, because there is absolutely nothing to gain by lowering the memory budget.
- nicoburns 2y ago> That critic would be manifesting his ignorance, because there is absolutely nothing to gain by lowering the memory budget. Given that compute is often priced proportional to (maximum) memory usage, there is potentially a lot to be gained: dramatically cheaper hosting costs. Of course if your hosting costs are small to be begin with then this likely isn't worthwhile.
- chipdart 2y ago> Given that compute is often priced proportional to (maximum) memory usage, (...) Let's look at numbers. Hetzner sells vCPUs with 4GB of RAM for less than 5$/month, and 8GB of RAM for less than $10/month. https://www.hetzner.com/cloud/ https://www.hetzner.com/cloud/ In my example, the cost of having garbage collection generation 0 events triggering twice a year would be an extra $5. If I wanted the frequency of these events to double, in theory I would save perhaps $2/month. If I ran a web-scale service with 10 times the nodes as-is, we're talking about a $50/month price tag difference. How much does a company charge for an engineer's hourly labor? How many years would it take to recover the cost of having an engineer tune a service's garbage collection strategy? People need to thing things through before discussing technical merits.