When exploring the possibility of entering the cryptocurrency exchange market, most people begin by enquiring…Read more
There are dozens of popular programming languages and platforms. Each with its own set of fans that are certain that their choice is the best language to solve the technical challenge at hand.
Some may argue that a specific language is designed to solve a specific problem, while others may counter that any programming language will suffice -just pick the one you know best.
There are programmers who may find certain cryptocurrency exchange programming languages convenient to use, but slow as they spend the majority of the time calling on databases. Others might argue that their language of choice can significantly reduce execution time and drive efficiencies within the process, thereby saving millions of dollars every year on cloud payments.
When cryptocurrency exchange language advocates want their language of choice to be used on a particular project, they will find countless arguments within various online communities vouching for different languages, and rationalizing each particular one.
With so much subjectivity and bias, how is it possible for those who are new to cryptocurrency exchange programming to make a rational choice?
There’s no one-size-fits-all approach to answering this question, so I’ve narrowed it down to the languages that work specifically well when building cryptocurrency exchanges. I’ve seen platforms built with PHP, Python, Go, Java and C# — so those are what I’ve decided to write about in this article.
*A note to technically advanced readers: when I write “programming language”, I really mean a combination of the language itself, compiler, runtime, standard library, and most popular libraries and prevalent development practices among programmers who use the language.
The Top Programming Languages for Cryptocurrency Exchange Software
Ten years ago, PHP was a relatively low-brow language, used by programmers with a basic skill set. Since then, the language has seen significant enhancements, and has been used to create some truly gargantuan products, like Facebook. Still, it’s a rather entry-level language that is used primarily to create simple websites, blogs and e-commerce portals.
As such, PHP is a poor choice when building a cryptocurrency exchange. When it comes to high-performance trading systems, it’s important to have control over as many variables as possible. PHP, unfortunately, leaves much to be desired because the language is constructed in order to be simple for novices. It does not have an advanced compiler and runtime, and therefore its programs are not particularly fast.
The developer experience is also lacking. Exchange software is inherently multi core, meaning it tries to do as much as possible in parallel — whereas PHP programs are sequential, with a framework or web server handling the low level concurrency details.
Multithreaded programs are rarely found in the PHP community. It is also uncommon to find people who use PHP heavily, and also have experience with low level and system programming. Cryptocurrency exchange software development requires both.
Of course, with enough talent, time, and money, you can solve any problem. Even if it means you have to use PHP to build cryptocurrency exchange technology.
As mentioned earlier, one great example of an entire ecosystem built on PHP is the world’s leading social media platform, Facebook. However, at one point, they had to create their own version of PHP to combat certain performance issues.
Python is a far stronger programming language than PHP, but even worse for the parallel programming capabilities required to build a cryptocurrency exchange. Its Global Interpreter Lock (GIL) halts any attempts to create fine grain parallel performance.
Python is a phenomenal programming language for a number of other aspects, including its top-class community, libraries, and performance capabilities. Unfortunately, due to GIL, it is not a recommended language for companies looking to build cryptocurrency exchange platforms.
Golang is a relatively new language that is being pushed by Google. It has gained popularity due to its simplicity, much like Google’s entire suite of products.
Go programs tend to spawn thousands, if not millions, of pseudo parallel processes called “goroutines”. Its language runtime then manages the mapping between goroutines and physical processors, and also handles communication between the two. It provides a very natural programming model when you want to handle millions of independent requests in parallel.
However, programming with such an easy-to-use language does come at a cost.
Smart mapping from goroutines to hardware is quite complex, and makes it difficult to interact with native code written in other languages. This includes operating system calls.
Exchange software tends to require frequent and complex I/O operations, and generally needs to closely interact with an underlying operating system. The performance price you have to pay for every such “external” call may quickly outweigh any gains you get from clever resource management.
Since you do not have control over how the CPU is being used, you are also unable to perform advanced functions like spin locks. It is typical for an order matcher to have a few threads, with each thread bound to a dedicated CPU core. In these rare cases, spin locks provide great latency improvement over other synchronization primitives.
However, Go takes away control over threads and it makes such advanced use cases next to impossible.
Here’s the bottom line: Go is great new language, but it is designed with other use cases in mind. I’ve seen it used in cryptocurrency exchange software, but its primary use case was not to perform routine tasks, but rather to enable development teams to push new boundaries in development.
None of these languages are ideal for cryptocurrency exchange software development
PHP, Python and Go are great languages but built with certain use cases in mind. They optimize for throughput, not latency and as such they tend to focus on features that would allow them to horizontally scale at the cost of individual request processing time.
PHP and Python are subpar choices for building a cryptocurrency exchange engine due to their internal features and lack of low level and parallel programming features. Go is an okay choice but developers must beware that sooner or later you will hit a wall and may even have to rewrite some critical pieces in more low level language.
There are three other languages which are better suited for high-performance programming which I’d like to cover in my next article: Java, C++ and C#.
Andrey Verbin, System Architect of Qoden Exchange
There are dozens of popular programming languages and platforms. Each with its own set of…Read more
How To Migrate Between Cryptocurrency Exchanges Are you looking to switch from one cryptocurrency exchange…Read more