Thread.sleep
causes the currently executing thread to sleep (temporarily cease execution) for the specified duration, subject to the precision and accuracy of system timers and schedulers" currentTimeMillis()
."--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
"TBF those things you can make a career of." - can you explain a little bit more, please?
--
You may still see interesting interactions with the kernel's flushing logic, which in some kernel versions holds locks that are way to wide (and may interfere with the logic of dirtying pages?). I only have indirect knowledge of this, but I think that @mikeb01 has some actual experience with it (want to chime in Mike?).
--
As Mike suggests, specific kernel versions can make dramatic difference. Have a look at 3.18.8 vs earlier, for example.
--
I saw a difference between 3.18 and 3.19, but found the one between 3.18.8 and earlier versions oferring much more severe impact. That's for scenarios with no tricks on the native side. Just pure Java. I guess that still mostly depend on your usage patterns.
Personally I would do something similar to what Gil mentions, grab a mmapped file and mlock it into memory and use it like a ring buffer. Have an archiving thread hanging off the back of that. Have the archiving thread use standard I/O rather than mmaped I/O (and possibly consider something like O_DIRECT for file writing so that it doesn't touch the page cache - I haven't actually tried this YMMV).
You will also need to look out for what happens when a connection requests a replay. If they have been disconnected for a while there is a strong possibility that there data has been paged out and will result in a page fault to bring it back in. I would consider standard file I/O for this too, given that it is not likely to be on the critical path.
Why does /dev/shm allow avoiding mlock'ing the pages? AFAIK those pages are swappable like any other.
sent from my phone
--
The other source of kernel latency with disk backed writes is the stable writeback "feature" that was introduced a few years ago. This is particularly problematic when doing writes over the same set of pages, e.g. ringbuffer. There's a patch to remediate it that I saw but haven't tracked whether it made it into kernel or not.
sent from my phone
Ok that makes sense then :). Swap + overcommit off should be the default/preferred configuration for these types of systems.
sent from my phone
On Monday, 4 May 2015 04:01:55 UTC+1, mikeb01 wrote:Personally I would do something similar to what Gil mentions, grab a mmapped file and mlock it into memory and use it like a ring buffer. Have an archiving thread hanging off the back of that. Have the archiving thread use standard I/O rather than mmaped I/O (and possibly consider something like O_DIRECT for file writing so that it doesn't touch the page cache - I haven't actually tried this YMMV).I've used this type of approach often myself and can attest that it works well. You ring buffer can be in /dev/shm if you want to avoid having to mlock it. The thread that is extending files needs to be off the critical path and not at risk of taking a page fault where it is not at safepoint, i.e. it needs to be doing its IO on the other side of a JNI boundary.
>> >>> email to mechanical-sympathy+unsub...@googlegroups.com.
>> >>> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "mechanical-sympathy" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to mechanical-sympathy+unsub...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mechanical-sympathy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to mechanical-sympathy+unsub...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Studying for the Turing test
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "mechanical-sympathy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to mechanical-sympathy+unsub...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mechanical-sympathy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mechanical-sympathy+unsub...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Studying for the Turing test
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.