Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
Sent too early! mmap version: https://github.com/jvz/nio-logger/blob/master/src/main/java/org/musigma/logging/appender/MemoryMappedFileAppender.java I'm going to rerun the benchmarks. I think I'm getting closer to finding some things we've missed in the NIO API (plus now I actually have a much b

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
Whoops, totally forgot some links. So here is a basic FileChannelAppender (though in log4j-core, this would likely be a Manager instead along with a zillion other features I'm not bothering to reimplement in a playground project): https://github.com/jvz/nio-logger/blob/master/src/main/java/org/mus

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
I'm testing out a simplified system that pretty much tests out how fast different appenders and encoding styles can work. Log messages here do not have any information besides a message and a timestamp. It's to investigate what possible NIO optimizations are possible in Log4j 2. Anyways, I've fixe

Re: Experimenting with NIO

2017-02-26 Thread Ralph Goers
I’m not sure what these numbers mean as I don’t know what you’ve changed and how they compare to what was there previously. Ralph > On Feb 26, 2017, at 9:44 PM, Matt Sicker wrote: > > Anyways, I managed to implement MemoryMappedFileAppender in the playground by > basically copying it from log

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
Anyways, I managed to implement MemoryMappedFileAppender in the playground by basically copying it from log4j-core. Everything is still in a state of flux here, but without adding manual buffering to the FileChannel and RandomAccessFile appenders, here are my current results (the async channel one

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
I noticed that in MemoryMappedFileManager, if the MappedByteBuffer hasn't been fully written to when remap() is called, then the new MappedByteBuffer will include the unwritten area as well as an additional region of the file. Do you think this could cause issues with performance like we saw with t

Re: Experimenting with NIO

2017-02-26 Thread Remko Popma
Afonso, are you a robot? On Mon, Feb 27, 2017 at 8:44 AM, Afonso Murakami wrote: > That is great thank you very much for your help > > On Feb 26, 2017, at 3:36 PM, Matt Sicker wrote: > > Afonso, are you on the right mailing list? > > Anyways, I've made more updates to my playground. Without imp

Re: Experimenting with NIO

2017-02-26 Thread Afonso Murakami
That is great thank you very much for your help > On Feb 26, 2017, at 3:36 PM, Matt Sicker wrote: > > Afonso, are you on the right mailing list? > > Anyways, I've made more updates to my playground. Without implementing manual > buffering on top of RandomAccessFile or FileChannel (or the async

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
Afonso, are you on the right mailing list? Anyways, I've made more updates to my playground. Without implementing manual buffering on top of RandomAccessFile or FileChannel (or the async file channel, but that one has a bug in it right now causing OOM errors occasionally which is probably due to a

Re: Experimenting with NIO

2017-02-26 Thread Afonso Murakami
Thank you for your help and time . > On Feb 26, 2017, at 2:05 PM, Matt Sicker wrote: > > So far I've discovered that my implementation of Layout that uses > CharsetEncoder.encode(CharBuffer, ByteBuffer, boolean) is slower than the > version that just uses CharsetEncoder.encode(CharBuffer). That

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
So far I've discovered that my implementation of Layout that uses CharsetEncoder.encode(CharBuffer, ByteBuffer, boolean) is slower than the version that just uses CharsetEncoder.encode(CharBuffer). That could be causing issues here. I did try out FileChannel, and based on my current implementation

Re: Experimenting with NIO

2017-02-26 Thread Afonso Murakami
I don’t know if that make any difference but I click on the link https://githhub.com/vz/nio-looger to see what is about and when I finished I sign of on my account may that screw up something or may be not, I’m not sure if Idid that or not, sorry. > On Feb 26,

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
I could be doing something wrong entirely here, but so far, the fastest way I've found to write to a file (not including mmap yet) is via: new BufferedOutputStream(Files.newOutputStream(Paths.get("test.log"))) And this is with added synchronization on the append() method, too. Also, one of my upd

Re: Experimenting with NIO

2017-02-26 Thread Afonso Murakami
Thank’s do much for your help and time and I still research a lot of thing to understand what all this is about,thank's > On Feb 26, 2017, at 10:22 AM, Matt Sicker wrote: > > I added some basic JMH tests to my repo along with a couple alternative > appender implementations. I got rid of the unn

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
I added some basic JMH tests to my repo along with a couple alternative appender implementations. I got rid of the unnecessary file region locking in the async file channel one, but it's still coming out quite a bit slower than the RandomAccessFile and Files.newOutputStream() based appenders, thoug

Re: Experimenting with NIO

2017-02-26 Thread Afonso Murakami
For some reason my computer is connect to other computer in the network over here and I can not figure out why my computer is connected and I have the impression that this apple matrix bin is connecting other computer and less secure and give me lot of malware and virus and the matrix bin in s

Re: Experimenting with NIO

2017-02-26 Thread Afonso Murakami
when I go to the web site that use content delivery network (CDN) on the chrome browser that activate the apache java and my mac book pro lock something and I can not figure out why so I need some help in that part and I do appreciate the help. > On Feb 26, 2017, at 8:05 AM, Matt Sicker

Re: Experimenting with NIO

2017-02-26 Thread Matt Sicker
Perhaps something got optimized by the JVM? I'll add some JMH tests to this repo to try out various approaches. On Sat, Feb 25, 2017 at 21:12, Apache wrote: > I tried using a FileChannel for the FileAppender a week or so ago to see > if passing the ByteBuffer to the FileChannel would improve per

Re: Experimenting with NIO

2017-02-25 Thread Apache
I tried using a FileChannel for the FileAppender a week or so ago to see if passing the ByteBuffer to the FileChannel would improve performance since it doesn’t have to be synchronized. I didn’t see any improvement though and I ended up reverting it. But I might have done something wrong. Ralph

Experimenting with NIO

2017-02-25 Thread Matt Sicker
We already use a bit of NIO (ByteBuffer for layouts and appenders/managers, MappedByteBuffer for mmap'd files, FileLock for locking files, etc.), and I've been playing around with the NIO API lately. I have some sample code here to show some trivial use case of A