I have an API that for an order routing platform that is in visual basic. The maximum frequency or orders to exchanges will be milliseconds, where the underlying systems are expected to be able to process a maximum of 1 order per millisecond.
Generally I would like to write in C++ or Java when I have this level of speed in mind, and have a broad stigma against visual basic for being inherently slower.
But since 1 millisecond is a long time in computer time, is visual basic still fast enough?
The algorithm will be reading information from the exchanges, crunching a few numbers and determining an order to send back to the exchanges.
I am estimating latency of 120 milliseconds, 1 millisecond to do the computational math, and then another 120 milliseconds back to the exchange. or less of course, but I know where the computers are geographically and this is about how long it should take.
I would like to keep the computational time at 1 millisecond, this isn't really a stretch for visual basic on a modern computer correct? (the local machine won't be doing much processing, as it will be fed most relevant data from the clearing firms data feeds)
Answer
All .NET languages are perfectly able to compete with the speed of C and even FORTRAN. It all depends on if they are used the correct way.
1) Both Java and .NET have considerable longer startup times than most native app. Therefore, you will have to have the application running and not starting it over and over on request.
2) Memory management is crucial when using managed heaps and if you are in need of reliable peak performance. Make sure, not to allocate large arrays over and over, since this will stress the GC too much and produce larger latencies.
3) Consider using optimized libraries. Some are around for C#/Visual Basic (ILNumerics) and Java (f.e. jblas). Recent tests have shown very good performance for numeric managed algorithms compared to native implementations and other frameworks.
4) Test your implementation and profile it! If you are positive, you could reach the performance goal with a C implementation, you can reach it with .NET as well.
No comments:
Post a Comment