2013年6月6日 星期四

Async RESTful Service with Disruptor 3

I am currently developing a small POC model for testing out the Async feature of Jersey 2 with the help of Disruptor to dispatch the RESTful request
Phase 1:

Detail:
Main Thread :HTTP RESTful Get of Input Parameter ---> Jersey 2 --> Disruptor Dispatch the parameter to another thread.
Thread 1 : GCD Calculation.
Thread 2:  Async Response to the client
Thread 3:  Using AMQP(RabbitMQ) to write the log to DB, Probably Cassandra and each value is written using JSON .


With this POC, what I want to know more about Disruptor over ArrayBlockQueue and the latest Jersey 2 JAX-WS  implementation.

Besides, I also wanted to test for the AMQP service.



I will jot down more information and the code here later on.

Stay Tuned.

6,June,2013 17.47 GMT +8

sun.misc.Unsafe in Netty

I am currently seeking for some involvement in some Open Source Project in Java.
For me, I am specially in interested in threading, high scalability for I/O.
Netty really catches my eyes.
Therefore, I used eGit to get a copy from their GitHub.


What I aware is their pooling of the ByteBuf, it makes use of sun.misc.Unsafe. It allows us to allocate the MEMORY OFF HEAPLY.

Get yourself a cup of coffee and enjoy the below links if you are interested in High Performance Java:

1 . Java Magic. Part 4: sun.misc.Unsafe - mishadoff thoughts

http://mishadoff.github.io/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/

 2 . Highly Scalable Blog
http://highlyscalable.wordpress.com/2012/02/02/direct-memory-access-in-java/


 I will write a more detailed style here to describe how Netty make use of Unsafe.