{"id":223,"date":"2014-01-12T18:18:14","date_gmt":"2014-01-12T18:18:14","guid":{"rendered":"http:\/\/www.smr.co.uk\/?p=223"},"modified":"2014-01-12T18:18:14","modified_gmt":"2014-01-12T18:18:14","slug":"low-latency-java-techniques","status":"publish","type":"post","link":"http:\/\/www.smr.co.uk\/?p=223","title":{"rendered":"Low Latency Java Techniques"},"content":{"rendered":"<p>\t\t\t\tHere are a list of web pages I&#8217;ve been reading recently:-<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/LMAX-Exchange\/disruptor\">Disruptor<\/a>\u00a0(lock free and garbage free) <a href=\"http:\/\/stackoverflow.com\/questions\/6559308\/how-does-lmaxs-disruptor-pattern-work\">see also<\/a><\/li>\n<li><a href=\"http:\/\/mentaaffinity.soliveirajr.com\/Page.mtw\">Pinning Threads<\/a><\/li>\n<li><a href=\"http:\/\/en.wikipedia.org\/wiki\/Processor_affinity\">Pinning Processes<\/a><\/li>\n<li><a href=\"http:\/\/www.javaworld.com\/article\/2077337\/build-ci-sdlc\/watch-your-hotspot-compiler-go.html\">JIT Warming<\/a>\u00a0(but warming time can be complex)<\/li>\n<li><a href=\"http:\/\/psy-lob-saw.blogspot.co.uk\/2013\/04\/lock-free-ipc-queue.html\">Memory Mapped IPC<\/a>\u00a0(within hosts)<\/li>\n<li><a href=\"http:\/\/mechanical-sympathy.blogspot.co.uk\/2013\/08\/lock-based-vs-lock-free-concurrent.html\">Lock Free Algorithms<\/a>\u00a0and <a href=\"http:\/\/skillsmatter.com\/course\/scala\/martin-thompsons-writing-concurrent-code-with-lock-free-algorithms\">Courses<\/a><\/li>\n<li><a href=\"http:\/\/mentablog.soliveirajr.com\/2013\/02\/inter-socket-communication-with-less-than-2-microseconds-latency\/\">Inter Socket IPC with UDP<\/a>\u00a0(between hosts)<\/li>\n<li><a href=\"http:\/\/www.infoq.com\/articles\/Java-7-Sockets-Direct-Protocol\">SDP with Infiband<\/a>\u00a0(if you have the hardware)<\/li>\n<li><a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/tech\/largememory-jsp-137182.html\">Java Large Pages<\/a>\u00a0(not always faster)<\/li>\n<li>Roll Your Own Everything including fix layer<\/li>\n<li>Immutable objects, but not for really low latency as need to create objects in the first place<\/li>\n<li><a href=\"http:\/\/mechanical-sympathy.blogspot.co.uk\/2012\/03\/fun-with-my-channels-nirvana-and-azul.html\">Cache friendly data structures<\/a>\u00a0cache misses are expensive<\/li>\n<li>O(1) or O(log2 n) at worst algorithms<\/li>\n<li>Single writer principle, all others are readers<\/li>\n<li>Number of threads = number of cores + 1<\/li>\n<li>Keep call stacks small and don&#8217;t use Spring as GC is harder with a big stack<\/li>\n<li>No locks or IO on the main flow<\/li>\n<li>Keep the flow simple and uncluttered<\/li>\n<li>Buy big machines with large RAM to avoid GC all together<\/li>\n<li>Use Unsafe for low level data manipulation and compare and swap.<\/li>\n<\/ul>\n<p>In due course I will be adding posts for each of these topics.\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are a list of web pages I&#8217;ve been reading recently:- Disruptor\u00a0(lock free and garbage free) see also Pinning Threads Pinning Processes JIT Warming\u00a0(but warming time can be complex) Memory Mapped IPC\u00a0(within hosts) Lock Free Algorithms\u00a0and Courses Inter Socket IPC &hellip; <a href=\"http:\/\/www.smr.co.uk\/?p=223\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a> <a href=\"http:\/\/www.smr.co.uk\/?p=223\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,9,11],"tags":[],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-java","category-low-latency","category-technology"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223"}],"version-history":[{"count":0,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/223\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.smr.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}