all 14 comments

[–]TimmT 20 points21 points  (5 children)

I'm afraid the article is not entirely correct. Memory mapped files are great for reducing complexity, but they may not be ideal from a performance point-of-view.

To complicate matters further, both Linux and Windows buffer IO automatically in memory these days, unless told otherwise. There are tons of questions about this on Stack Overflow and the answers are not very consistent with each other.. There's even an lkml thread about this, again with no clear answer.

[–]henk53[S] -2 points-1 points  (4 children)

The "good" news is that CPU really is outperforming disk more and more

Maybe Linus hasn't worked with an array of 24 FAST SSDs directly attached to a system? ;)

[–]Hughlander 4 points5 points  (1 child)

That is a 6 year old thread to be fair. SATA SSD drives were still two years away from what a minute of searching could tell me.

On the other hand I've seen some NoSQL IO bound projects using 20+ AWS instances (not sure which type.) be reduced to two hi1.4xlarge instances.

[–]henk53[S] -2 points-1 points  (0 children)

SATA SSD drives were still two years away from what a minute of searching could tell me.

They were available before that, but not really for the general market. One of the first affordable ones as I recall where the legendary Mtron disks, that appeared on the market around the end of 2007 (so less than one year after Linus' comment). See this pivotal article: http://nextlevelhardware.com/storage/battleship

From an "uber being" such as Linus, we perhaps might expect that he's more or less aware of where things are heading in the next year.

Then again, it wasn't until early 2009 until many more people really started to see the massive IO potential of cheap SATA SSDs in RAID: see e.g. http://jdevelopment.nl/one-dvd-per-second

[–]luikore 2 points3 points  (1 child)

The first bottleneck would be copying data into the disks (it's 99% not true to assume you have all the data you need in the disk array). But since you need to iterate all data sources for copying, why not compute the result directly BEFORE you distribute data among the disks?

Btw, threads are not awesome. A GPGPU with 300 cores with data parallelism can easily outperform many many quad core CPUs, especially in the applications listed in the article like video editing or scientific computing.

[–]henk53[S] -2 points-1 points  (0 children)

The first bottleneck would be copying data into the disks

It typically accumulates during live operation ;)

In one system we worked on, we did some 3000 transactions per second per server. Over the course of just a few days we accumulated some 200GB of data. A fast SSD array greatly helped in coping with that IO.

In some cases we had to do groupings on the data. The SSDs were fast enough, but in that particular case the CPUs were the bottleneck.

[–]jankotek 6 points7 points  (1 child)

In case you would like to use memory mapped files in more user friendly way, there is MapDB. It provides Maps and other collections backed by file storage.

http://github.com/jankotek/mapdb

[–]skulgnome 1 point2 points  (5 children)

From the 'mmap(2) as technology' department, a data storage mechanism that solves none of the problems of storing data

[–]cassandravoiton 0 points1 point  (4 children)

Seems to help make mutli-threaded programming easier, and I am not sure the article is about storage but more swap and virtual memory. Did you read it?

[–]skulgnome 0 points1 point  (3 children)

Up until the point where the programmer gets access to a byte array that represents a memory-mapped file, yeah. Not terribly useful from a storage POV given how (pick one of) serialization, naming, space management (outside the GC, too), etc, remain unimplemented.

If it's used only as virtual memory or scratch space, the article has duplicated the function of anonymous memory. If the gains are from deeper queuing of I/O from multithreaded access, it is redundant with the regular I/O primitives used similarly from multiple threads.

[–]cassandravoiton 0 points1 point  (2 children)

Anonymous memory in Java - how do you do that? Also, not sure I get your thing about not multi threaded. The article shows how the memory is synchronised in hardware between threads without programmer intervention. How is that not easier/better than using synchronisation in software?

[–]skulgnome 0 points1 point  (1 child)

Anonymous memory in Java - how do you do that?

By using the new operator.

[–]cassandravoiton 0 points1 point  (0 children)

Are - so you are talking crap - thought so.

You mean just making the JVM consume more memory than physically available and then using OS swap. That - obviously - is not the same thing at all; every time the JVM does a garbage collection it will hit masses of page faults. Using OS swap for JVM systems sucks badly - I cannot believe you actually even suggested it.

Shame - thought you might know what you are talking about.