r/programming • • Jan 04 '19

Using Java to Read Really, Really Large Files

https://medium.com/@paigen11/a6f8a3f44649
7 Upvotes

31 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jan 07 '19

Well, read the comment above?

1

u/gnus-migrate Jan 07 '19

I responded to the comment above. Clearly I missed something. What did I miss?

1

u/[deleted] Jan 07 '19

My guess is that it has to do with a wounded ego of a Java programmer or reading-comprehension skills.

1

u/gnus-migrate Jan 07 '19

No it has to do with you assuming that I live inside your head and can understand what you're thinking at any given moment. I'm asking you to explain where you're coming from so that a person who doesn't speak your language can understand what you're trying to say.

1

u/[deleted] Jan 08 '19

Well, for zero-copy to work memory needs to be aligned in a certain way. The way depends on what device you are reading from, mostly its block size, but there could be more factors. How would Java know how to align memory before you even tell it what device you are going to be reading from. This is why the question about tempfs, because in-memory file-systems usually have different (smaller) block size.

Another but related concern: what will Java do if the write and read buffers are of different sizes? What if neither buffer is a multiple of the other buffer?

Finally, filesystems that receive their content from network, like NFS, will probably copy data more times: because they also need to read it from a socket, but you are issuing a call against VFS, but it is possible in principle to have all the necessary machinery in the user-space, i.e. the entire IP stack, in which case you will be able to do no / less copying, not even bothering the kernel.

The question about JBD is because you can have multiple entities standing in the data path: how can you tell if all of them will be doing no copying? This is similar to the previous one, but is supposed to point out that it doesn't only happen in data that comes from network, the most popular Linux file-system normally sits atop JBD.


None of these questions are anywhere near answered by documentation, because Java documentation is not written for programmers. It's a marketing fluff full of subjective opinions, value judgements and right-out propaganda intended for managers to choose Java over other languages rather than trying to be thorough or helpful.

That's why Java programmers are so lame when it comes to system programming (but they just love doing it!). Every time I see some system tools written in Java, it's like watching a surgeon using toy tools to operate a real patient.

2

u/gnus-migrate Jan 09 '19

I had a reply, but fuck it. Find someone else to feed your ego. I was looking for a technical discussion not a pissing contest.