By Artie Pesh-Imam
Software Engineer
At CX, we have a variety of different products which we use to deliver our cloud storage services, written in a variety of different languages and platforms. We feel the platform and the tools we’re using to build the API’s that our client products use are efficient and come with many benefits, and we’d like to tell you more about them.
Our language of choice for implementing our server API is Scala. Scala is a modern, succinct language which can also leverage the mountain of open source offerings that are available for the Java virtual machine (JVM.) Scala is a hybrid language which allows for developers to use either a functional or object-oriented programming style. We’ve implemented our platform using the object-oriented approach. We are considering sprinkling some functional aspects in the near future, and you’ll hear about it when we do.
Also interesting is choosing libraries to help us build the API servers for CX. Scala is an emerging language, and while we can use products that run on the JVM, it’s preferable to use libraries that are written in Scala so we can utilize the Scala goodness. Specifically, perhaps the most important advantage with using a library native to Scala is that the library can take advantage of aspects of Scala which are unavailable in Java. A couple examples of this are: Lazy Evaluation and the Option pattern. Yes, it’s possible to achieve some of these aspects through various techniques, but the fact remains that doing so requires extra code and effort.
Here’s a sampling of the libraries that we use:
Squeryl – A Scala-based object-relational mapping (ORM)
Ostrich – A Scala-based statistics collector from Twitter
Specs2 – A Scala-based testing tool
Dispatch – A Scala-based HTTP client
We’ve been doing especially exciting things with Squeryl. As CX continues to grow, we are facing the problem of scaling our database horizontally. We’re going to take a variety of infrastructural steps, but we’ve also had to extend Squeryl to support talking to multiple databases. With help of the product lead, we were able to accomplish this in a typesafe way. I’m hoping we get an opportunity to share this back with the community.
All of these are fantastic libraries which have proven to be immensely useful. Also, in the future, we’re looking to add some other popular libraries to our toolbox, including Akka.
We’ll continue sharing with you interesting details of how our server architecture evolves as CX continues to grow.
