Categories
Java Technology

Java Garbage Collection

            <h2>TLAB and the Cost of Object Allocation</h2>

To avoid contention each thread is assigned a Thread Local Allocation Buffer (TLAB) from which it allocates objects. Using TLABs allows object allocation to scale with number of threads by avoiding contention on a single memory resource. Object allocation via a TLAB is a very cheap operation; it simply bumps a pointer for the object size which takes roughly 10 instructions on most platforms. Heap memory allocation for Java is even cheaper than using malloc from the C runtime. When a TLAB is exhausted a thread simply requests a new one from the Eden space. When Eden has been filled a minor collection commences.  [ref]

Weak References explained.

Categories
Data Gathering Technology

Nodejs Modules

            <ul>
<li><a href="https://npmjs.org/doc/">npm</a> of course</li>
<li><a href="http://www.anupshinde.com/posts/how-to-create-nodejs-npm-package/">Create nodejs packages</a></li>
<li><a href="http://package.json.nodejitsu.com">package.json interactive guide</a></li>
<li><a href="http://visionmedia.github.io/masteringnode/book.html">mastering node </a>book maybe one day</li>
<li><a href="http://coppieters.blogspot.co.uk/2013/03/tutorial-explaining-module-export.html">nodejs modules</a></li>
Categories
Java Low Latency Technology

Floating Point Numbers in Low Latency Applications

            Clearly there are lots of issues with using <a href="http://www.ibm.com/developerworks/library/j-jtp0114/">float and double</a> and using BigDecimal is not going to cut it an low latency financial world unless you are not really that low latency.  So what is the answer. As usual it depends, but here are some suggestions.
  • Look after the pennies rather than the pounds. That is use cents rather than dollars, or what ever is the lowest precision in your world.
  • Ensure intermediate calculations are as exact as possible so that rounding errors are not accumulated.
  • Build or borrow a maths library to compare floating point numbers for instance (i.e float and double) with an epsilon value, i.e. a nearly equals method so that you can hide all the gory details in a library. Also add rounding and precision to the laundry list. Slightly surprised Java’s core libraries don’t cover this better.
  • Use string representations on the wire rounded to appropriate levels of precision. Sure there is an overhead in conversion but at least its accurate.
  • A reminder of sizes:-
    • Integer = 32 bits, 4 bytes = 2^31 =+- 2147483648 = 2.14748E+9
    • Long = 64 bits, 8 byes = 2^63 = +-9.22337E+18
    • Float = 32 bits, 4 bytes = +-3.5E+38 and +-1.4E-45, about 7 digits
    • Double = 64 bits, 8 bytes = +-1.7E+308 and +-4.9E-324, about 15 digits
    • String = words, 2 bytes, short

References

Java theory and practice: Where’s your point?
Java’s new math, Part 2: Floating-point numbers
Java float / double comparison

Categories
Technology

Free Compute Resources

            <h2>Free(ish) Cloud Host Computers</h2>

Git Repositories

Continuous Integration

Cloud Storage

Categories
Java Low Latency Technology

Low Latency Java Blogs and Websites

            Here are some interesting low latency blogs and websites I've been reading:-
Categories
Java Low Latency Technology

Low Latency Java Techniques

            Here are a list of web pages I've been reading recently:-

In due course I will be adding posts for each of these topics.