News for hackers. Stuff that matters.
Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @12:11AM (#17455220)
> The advent of nonvolatile memory is changing the equation, though, and swapping is starting to look interesting again

It's not clear to me why the nonvolatile part makes any difference to swap. I'd expect it would make more sense to attach a volatile, RAM-based SSD [1], maybe via PCIe or even once removed via storage fabric.

Perhaps it's just incidental, and it's merely price and/or capacity that's important, considering that it's attached via the memory bus.

[1] Not that I've ever seen such a product with a high enough capacity for a low enough price. It seems like it could be a way to recycle old and/or slow RAM, maybe a startup idea, but I'm no hardware guy.

Re:The final step for huge-page swapping by shawn on Wednesday July 04, 2018 @12:26AM (#17455262)
In the game and simulation industry, texture resolution is a problem. If you run the math on how big textures need to be to match pixel resolution 1:1 in 3D space, it quickly becomes infeasable for large scenes.

One solution is to stream the mip levels, and to create virtualized mipmaps. This basically lets you create a 128k by 128k texture, which works fine because only small blocks are loaded. It’s literally the same thing as virtual memory, but for texture memory.

One downside is that when you shut down the game / simulation, all of that data no longer exists. It was virtual. It either streamed from the sever or you packed it to disk somewhere. Either way you have to set it up again the next time the program starts.

I don’t know whether the present topic would let you bypass this limitation, but if there was some way to start a program with a huge amount of memory allocations preloaded, that would be very attractive. And if you can reboot without losing that, then suddenly you can start crafting persistent worlds that load instantly with ~infinite resolution.

This is the dream that voxel tech was supposed to make into reality, and it will only become more of a concern over time as mixed reality tech matures.

Re:The final step for huge-page swapping by sterlind on Wednesday July 04, 2018 @01:17AM (#17455390)
the feature you're looking for is called opening a memory mapped file. I've seen tremendous performance improvements, but it's a really underused feature for some reason. Memory map Performance is incredible.
Re:The final step for huge-page swapping by bluejekyll on Wednesday July 04, 2018 @10:19AM (#17457394)
> it's a really underused feature for some reason

My suspicion is that it’s mainly because memory mapping files, while safe for reading, have a whole bunch of edge cases where the file can accidentally be corrupted.

Re:The final step for huge-page swapping by wtallis on Wednesday July 04, 2018 @01:26AM (#17455418)
Does Windows have any analog to madvise()? It seems like that's probably necessary to making things work well when you're mapping huge data sets, unless you're sure they reside on really fast storage.
Re:The final step for huge-page swapping by PeCaN on Wednesday July 04, 2018 @02:24AM (#17455584)
Windows 8 and later has PrefetchVirtualMemory[1]. Before that your best bet is to get a little hacky and try reading the file asynchronously to get it in the cache (Windows caches files pretty aggressively, so this more or less works).

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/hh7...

Re:The final step for huge-page swapping by senozhatsky on Wednesday July 04, 2018 @04:08AM (#17455901)
Seems that VirtualAlloc() [1] is a little bit closer to madvise(), but still is pretty far. madvise() is quite powerful. For instance, take a look at MADV_FREE.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa3...

-ss

Re:The final step for huge-page swapping by PeCaN on Wednesday July 04, 2018 @01:08PM (#17458298)
I figured the use-case here was MADV_WILLNEED, which is what PrefetchVirtualMemory is for. VirtualAlloc flags would be for things like reserving virtual pages without committing them.

There's no single API on Windows that does the myriad of things that madvise does.

Re:The final step for huge-page swapping by ddorian43 on Wednesday July 04, 2018 @01:29AM (#17455427)
Yep, see lmdb read performance. Or many search engines doing mmap.
Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @04:14AM (#17455924)
> I don’t know whether the present topic would let you bypass this limitation

I can't imagine that it would, since it's just swapping. That's why I asked the question.

How to take advantage of the nonvolatile aspect of that memory as you describe is a much broader, more complicated topic, involving bootloaders and kernels.

Re:The final step for huge-page swapping by benwills on Wednesday July 04, 2018 @01:24AM (#17455405)
My interpretation wasn't that it was specifically that it's non-volatile. Rather, that it's the performance:price of NVME that's "changing the equation."

The combination of NVME's IOPS and throughput, particularly for sequential reads/writes like you'd have with something like huge pages, begins making it a reasonable consideration for caching/secondary memory in certain situations.

edit: s/NVME/non-volatile/

Re:The final step for huge-page swapping by saas_co_de on Wednesday July 04, 2018 @05:59AM (#17456252)
I think this is correct.

With 24X NVMe servers now common and cheap (AMD EPYC) you can get 96GB/s (theoretical max, and real is not far off) onto NVMe which is same order of magnitude as memory bandwidth.

When PCI-e 4 comes out next year the bandwidth will double and SSD manufacturers will have no problem doubling the performance of NVMe devices once the interface supports it so at that point the bandwidth on NVMe will surpass RAM.

The major caveat is that sequential read/write is much faster than random (this can be offset to a certain extent if you can queue up many random requests at the same time but each random request has a very high latency) so I would expect that switching from 4K to 2MB pages would have significant advantages on the storage side beyond efficiencies gained in the kernel.

Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @04:24AM (#17455958)
That's credible given the announced capacities and expecte performance, but I'll be interested to see how the real prices/availability compare with RAM, especially if Intel is the sole supplier.
Re:The final step for huge-page swapping by wtallis on Wednesday July 04, 2018 @05:02AM (#17456081)
Non-volatile memories like NAND flash and Intel's 3D XPoint have fundamental advantages over DRAM that guarantee they'll be cheaper than DRAM. DRAM requires a transistor for every memory cell, and stores one bit per cell. Non-volatile memories like NAND flash and 3D XPoint don't need an extra transistor to isolate each memory cell, which frees them up to be built with multiple layers per die, and the non-volatility is key to their ability to store more than one bit per memory cell (though the currently-shipping 3D XPoint is only storing one bit per cell).

So the non-volatility is indirectly related to why those memories are more cost-effective than DRAM, but they still have the array structure that allows for much lower access times than a hard drive.

Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @01:36PM (#17458463)
> like NAND flash

This has been in SSDs for long enough without being hailed as a game changer, which is why I question anything common between the two that appears to be called out as the cause.

> Intel's 3D XPoint have fundamental advantages over DRAM that guarantee they'll be cheaper

This may be true for the producer, but in a monopoly situation, one could reasonably expect any savings will be collected as profit rather than passed on to the consumer.

Re:The final step for huge-page swapping by wtallis on Thursday July 05, 2018 @01:37AM (#17461080)
> This has been in SSDs for long enough without being hailed as a game changer, which is why I question anything common between the two that appears to be called out as the cause.

It's only been in the past few years that flash memory has been accessed through interfaces that weren't made for hard drives. NVMe is recent enough that it's no surprise to see that the conservative, slow-evolving OS virtual memory subsystem still hasn't been entirely re-architected to account for the new possibilities that fast, low-latency storage brings.

Re:The final step for huge-page swapping by mmt on Thursday July 05, 2018 @02:53AM (#17461330)
> It's only been in the past few years that flash memory has been accessed through interfaces that weren't made for hard drives.

Just how few years are we talking about? From what I recall, Fusion-IO's model didn't use a hard disk interface, and their products were in the sub-millisecond latency range over 6 years ago, maybe even a full decade.

At the time (and more or less continuously since then), I've questioned why anyone would want to pay such a huge premium over disk-imitating flash (that is, enough of it to match the storage, throughput, and IOPS).

Low latency would be a credible explanation, although I don't recall anything in the way of even benchmarks showing the difference with real-world software like a database.

All that said, unless I'm missing something like an order of magnitude drop in latency, I'm wondering why.. this time it's different?

Re:The final step for huge-page swapping by bhouston on Wednesday July 04, 2018 @09:40AM (#17457191)
Old ram tends to be at small sizes. Thus it makes it not that economical to act as backup storage for the modern era.
Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @01:02PM (#17458271)
When I say "old RAM" I mean from the same, current, modern era, though, yes, it is often smaller or lower-density due to being pulls from upgrades, for example. The modern era often also includes previous-generation technology, such as DDR3 in use today even though DDR4 is available (with non-intuitive pricing relationships at any given time).

That said, why would size (density) have to do with being economical? Are the required memory controllers to expensive, because there simply aren't any other than inside CPUs? The train of logic needs explaining.

Re:The final step for huge-page swapping by bhouston on Wednesday July 04, 2018 @06:15PM (#17459707)
It is hard to recycle used equipment at scale generally and economically. Old ram if it is small will take up a ton of space as well.

It is the same reason why I don't reuse old hds, it does make economic sense. I would rather overpay for a 12 tb drive than get 12 1tb drives for free. The trouble, increased failure rates, the space usage etc is just not worth it.

A few ssds in a high speed non redundant raid would be much better.

Or a new class of volitile slow ram that has tons of space would be interesting. So more space at lower cost than ram but slower. That would be interesting. Give me a few 128GB sticks please.

Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @06:52PM (#17459857)
> It is hard to recycle used equipment at scale generally and economically. Old ram if it is small will take up a ton of space as well.

You've said this already, but both of these statements need unpacking and quantifying, especially "a ton of space".

There's been a persistent myth that, in datacenters, it's space that's the expensive and/or scarce resource. It isn't. It's power and cooling. Only in the last 5-6 years have we seen the construction of datacenter facilities that could handle half-U densities, let alone what some "blade" systems were trying to do.

> It is the same reason why I don't reuse old hds, it does make economic sense. I would rather overpay for a 12 tb drive than get 12 1tb drives for free. The trouble, increased failure rates,

This is a false equivalence, since RAM doesn't have moving parts. A better comparison would be if you discovered a box of brand new drives, still sealed in their bags with dessicant.

Even ignoring the fact that 12 drives will have much better performance than a single one, would you still just blindly throw them away to buy the single one, without considering if it would be cheaper to buy 12 disk slots instead?

If the answer is "yes", this is inconsistent with "economic".

> the space usage etc is just not worth it.

I've already addressed the space usage as a red herring. What's the "etc"?

> A few ssds in a high speed non redundant raid would be much better.

Why a few? Isn't a single high-end one enough to saturate an NVMe or PCIe slot these days?

> Or a new class of volitile slow ram that has tons of space would be interesting. So more space at lower cost than ram but slower. That would be interesting. Give me a few 128GB sticks please.

What if this "new" class is actually DDR3 and the "sticks" are actually PCIe cards? That's what I've been suggesting.

Re:The final step for huge-page swapping by bhouston on Wednesday July 04, 2018 @08:21PM (#17460128)
> Even ignoring the fact that 12 drives will have much better performance than a single one, would you still just blindly throw them away to buy the single one, without considering if it would be cheaper to buy 12 disk slots instead?

Density does matter. And 12 individual disk will have a high failure rate than one disk because there is 12x electronics, 12x motors, 12x seals. Also the power needs for 12 disks is higher than 1. And you would need more raid cpu power to coordinate 12x disks.

> Why a few? Isn't a single high-end one enough to saturate an NVMe or PCIe slot these days?

Sure. I feel like you are just arguing for arguing sake here. You get 1GBps from most ssds and ddr3 is around 15GBps or so.

> What if this "new" class is actually DDR3 and the "sticks" are actually PCIe cards? That's what I've been suggesting

If it was significantly cheaper and new sure. Ddr3 is just as expensive as ddr4 right now.

No body running a professional data center wants the unpredictability of used parts unless they have had very consistent and tame histories. According to large scale studies ddr has increasing error rates as they age: https://ai.google/research/pubs/pub35162

Re:The final step for huge-page swapping by Dylan16807 on Wednesday July 04, 2018 @11:14PM (#17460632)
> Density does matter. And 12 individual disk will have a high failure rate than one disk because there is 12x electronics, 12x motors, 12x seals.

If you absolutely have to store 12TB of data and not spend another dollar, more drives are less reliable. In most situations having more drives makes it a lot easier to protect your data, because you can use parity.

> And you would need more raid cpu power to coordinate 12x disks.

A very small CPU cost; the drives are only doing 100 IOPS. And in return you get 4x-10x the throughput.

Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @11:29PM (#17460685)
> If you absolutely have to store 12TB of data and not spend another dollar, more drives are less reliable. In most situations having more drives makes it a lot easier to protect your data, because you can use parity.

I think what we're talking about is aggregates, so think about 120 1TB drives versus 10 12TB drives, if that's helpful.

If the failure rate per drive is comparable, then the failure rate per TB is 12 times higher for the the smaller drives. Arranging them in a RAID doesn't change this calculation.

> A very small CPU cost; the drives are only doing 100 IOPS. And in return you get 4x-10x the throughput.

I did stipulate to ignoring any performance difference, so we can assume that those 12 drives are concatenated rather than RAIDed, which I believe is an immesurable amount of difference in CPU load.

Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @11:16PM (#17460640)
> Density does matter.

In what way? You have yet to quantify this or the "ton of space" assertion. I'm not saying that density can't matter, just that it doesn't in the practical case. The only time I've heard otherwise is from vendors (hardware or datacenter) pushing a high-density product (which was never any cheaper than the less-dense alternative).

> And 12 individual disk will have a high failure rate than one disk because there is 12x electronics, 12x motors, 12x seals. Also the power needs for 12 disks is higher than 1. And you would need more raid cpu power to coordinate 12x disks.

Of course, but these are all calculable costs (although CPU cost for concatenation is de minimis). So, again, do you just not even perform that calculation?

> I feel like you are just arguing for arguing sake here.

I'm just trying to clarify what point you're making when you specify a particular solution, especially a RAID, which carries an associated cost, in the context of a dicussion about the economy of various options.

> If it was significantly cheaper and new sure. Ddr3 is just as expensive as ddr4 right now.

I maintain that new doesn't matter (see below). As for significantly cheaper, if it's recycled (be it already purchased but unused, spares, or working pulls), it would be a form of gratis-free. If a vendor has significant stock of now-undesirable lower-density or lower-speed memory modules (maybe even bare chips), that can result in a steep discount. It doesn't really matter if it's DDR3 or DDR4.

> No body running a professional data center wants the unpredictability of used parts unless they have had very consistent and tame histories. According to large scale studies ddr has increasing error rates as they age: https://ai.google/research/pubs/pub35162

Thanks for that study. I was unaware memory suffered from aging quite that much. That's further reason for disqualifying from recycling parts of unknown provenance (since they could be pulls due to a UE), but such parts would be disqualified anyway

Still, I fear that you're forgetting we're talking about swap here, not main memory. There's much more wiggle room for doing something like hot-sparing, even without otherwise having a RAID, since the performance of the backend storage (RAM) dwarfs the performance of the frontend (PCIe).

> Conclusion 3: The incidence of CEs increases with age, while the incidence of UEs decreases with age (due to re- placements).

This conclusion also suggests that there's a skew toward early mortality, so a pool of used, known-good DIMMs would actually be more reliable (and predictable, based on this study) than a pool of brand new ones.

Re:The final step for huge-page swapping by bhouston on Thursday July 05, 2018 @06:55AM (#17462243)
I think we can agree to disagree here for the most part.

It was an interesting discussion. I do think there is a market for another type of volitile storage in PCs as long as DDR prices stay sky high as they are now, faster than SSD and slower than DDR4, and much cheaper than DDR4, close to the prices of SSD and with much higher read-write capabilities.

The problem with SSDs is their limited read-write count I guess as their cost are actually sort of excellent these days.

With regards to hard drives I actually follow backblaze's lead, thus it is received knowledge. They tend to buy the largest drives they can that are not premium priced:

https://www.backblaze.com/b2/hard-drive-test-data.html

Re:The final step for huge-page swapping by mmt on Thursday July 05, 2018 @03:23PM (#17466034)
Well, the market certainly agrees with you..there has never, to my knowledge, been anything like what I describe, other than for trivial capacities.

> With regards to hard drives I actually follow backblaze's lead, thus it is received knowledge. They tend to buy the largest drives they can that are not premium priced

This is completely valid for comparable use cases (which I think are vanishingly rare.. usually, performance matters). Their data is, of course, invaluable to the tech community at large (and potentially an annoyance to drive manufacturers).

Re:The final step for huge-page swapping by shawnz on Wednesday July 04, 2018 @09:36AM (#17457171)
> It's not clear to me why the nonvolatile part makes any difference to swap. I'd expect it would make more sense to attach a volatile, RAM-based SSD

Why not just attach that RAM as system memory in such a situation? The point of using nonvolatile is that it's cheaper and consumes less energy

Re:The final step for huge-page swapping by mmt on Wednesday July 04, 2018 @12:53PM (#17458221)
> Why not just attach that RAM as system memory in such a situation?

Because the number of available DIMM slots, and therefore total capacity, is scarce. Increases in capacity require increases in density, which carry a cost (and presumably power density and/or speed) premium.

System memory scarcity is why swap is a thing in the first place.

Having that extra RAM on a slower, farther bus, as swap, means it doesn't have quite as stringent performance requirements (or abilities) with the benefit of increased overall capacity. This tradeoff sounds familiar.

> The point of using nonvolatile is that it's cheaper

That has yet to be seen. It stands to reason that it'll be cheaper than the RAM that would otherwise go in the same DIMM slot, but it won't perform as well, either. We can be confident it will perform much better than even PCIe/NVMe SSDs.

Is it cheaper than a generation or two ago's RAM in a big array (which, again, I know doesn't actually exist)?

The main question is, given Intel's monopoly, what the real world price per performance is going to be like.

> consumes less energy

I hadn't really thought about this as a significant consideration, although at very large memory capacities a few watts here and there do add up, and it's certainly important when comparing anything new against anything old. Still, it seems like it would just be another cost factor.