I've been reading a lot about low latency financial systems (especially since the famous case of corporate espionage) and the idea of low latency systems has been in my mind ever since. There are a million applications that can use what these guys are doing, so I would like to learn more about the topic. The thing is I cannot find anything valuable about the topic. Can anybody recommend books, sites, examples on low latency systems?
相关问题
- Java COM bridge
- Name for a method that has only side effects
- Best way to keep the user-interface up-to-date?
- should I write more descriptive function names or
- Open a new tab in firefox and keep ff in the backg
相关文章
- Should client-server code be written in one “proje
- Algorithm for maximizing coverage of rectangular a
- Is there an existing solution for these particular
- What is Scope Creep? [closed]
- How can I modify .xfdl files? (Update #1)
- What is the best algorithm to shuffle cards? [clos
- Hashtable and list side by side?
- Regular expression which matches at least two word
I would like to give some comments about Low Latency Programming. Currently I have more than 5 years of experience in developing low latency and high execution engines in financial software.
Is it necessary to understand what is latency?
Latency means it needs time to complete your process. It does not necessarily depend on the development tools you are using, like java,c++,.net etc., it depends on your programming skills, and system.
Suppose you are using java but one mistake by you can make a delay in process. For example you have developed a trading application in which on every price refresh you call some functions and so on. This can result in extra variables, unnecessary memory use, unnecessary loops which may cause delay in process. Same application developed in .net may perform better than the java if the developer cared about the above mistakes.
It also depends on your server system, like multi processor system may perform well if your application is multithreaded.
Well, its not just "traditional" real time programming, its everything. i work for a stock exchange -- speed is king. a typical problem is whats the fastest way to write to a file? the fastest way to serialize an object? etc.
Typically, work in low-latency environments means having an understanding of call dependencies and how to reduce them to minimize the dependency chain. This includes the use of data structures and libraries to store desired cacheable data as well as refactoring existing resources to reduce interdependencies.
If you are interested in Java low-latency developing, you should know that it can be done without a RTSJ (Real-Time) JVM provided that you keep the Garbage Collector under control. I suggest you take a look on this article that talks about Java Development without GC overhead. We also have many other articles in our site that talk about low-latency Java components.
Low latency is a function of many things, the two most important ones being:
So, if you are say writing an Order Matching system, the network latency would represent how soon within your network were you able to receive the order matching request. And processing latency would represent the time taken by your application to match the Order against existing, open orders.
Multicast, UDP, reliable multicast, Kernel bypass (supported by Java 7, Informatica Ultra Messaging, and many others) on Infiniband networks are some common technologies used by all companies in this field.
Additionally, there are low latency programming frameworks like disruptor (http://code.google.com/p/disruptor/) which implement design patterns for dealing with low latency applications. What could kill you is having to write to a DB or log files as part of your main workflow. You will have to come up with unique solutions that fulfill the requirements of the problem you are trying to solve.
In languages like Java, implementing your app such that it creates (almost) zero garbage becomes extremely important to latency. As Adamski says, having a knowledge of Java memory model is extremely important. Understand different JVM implementations, and their limitations. Typical Java design patterns around small object creation are the first things that you will throw out of the window - one can never fix the Java Garbage Collector enough to achieve low latency - the only thing that can be fixed is the garbage.
Good luck!
There are many good answer in this post. I would like to add my experience also
To achieve low latency in java you have to take control of GC in java, there are many ways to do that for eg pre-allocate objects(i.e use flyweight design pattern), use primitive objects - trove is very good for that, all data structure are based on primitive, Reuse object instance for eg create system wide dictionary to reduce creating new objects, very good option when reading data from stream/socket/db
Try to use wait-free algo( which is bit difficult), lock free algo. You can find tons of example for that
Use in-memory computing. Memory is cheap, you can have tera byte of data in memory.
If you can master bit-wise algo then it gives very good performance.
Use mechnical sympathy - Refer lmax disruptor, excellent framework