About RocketUncle

RocketUncle/Zyllem rethought the model of courier services by connecting clients to available freelance drivers for same-day deliveries at affordable prices. RocketUncle has a complex algorithm that takes locations for pickups and deliveries into account and matches the best-suited driver. But in addition, of course, a driver can pick up more than one package, so the algorithm takes that into account, too. “Getting our algorithm right and therefore assigning drivers in most effective manner, is what passes on the savings to the customer,” Guy Bensky explains to us. RocketUncle is working with Guy from Rabensky Algorithmic Solutions as a Lead Algorithm Programmer to find a solution.

The Challenge

Since the algorithm is quite computationally intensive, it was written in C++. The initial solution was to create a simple web-interface using Apache2 with PHP that translated the queries into inputs for the C++ program. This quickly became unmanageable as the program has a long startup time and this solution required it to run each time a query arrived. Simply put, making two technologies work together, which were meant for another purpose, turned out messy and difficult.

Faced by this challenge Guy opted initially to continue using Apache2/PHP and created a socket communication protocol with the C++ program. But there were issues: “We saw that creating such a communication protocol was almost the same as having the queries arrive directly to the C++ program, bypassing the Apache2 server completely.”

The next option Guy and his team considered was to use a simple home-grown solution. They soon realised that given today’s abundance of platforms (iOS, Android, various web browsers, etc) implementing, maintaining and testing a new communication protocol would be an integration nightmare.

The Solution

Guy decided to take his issue to the web and search for a solution. He tells us: “All our platforms have HTTP queries already built-in. We knew how simple this could be to integrate. So I set out to find a way to create an HTTP server in C++.”

It sounds like a simple solution, but it was quickly discovered that creating this was more complex, especially since HTTP data transfer has has many implementation specific idiosyncrasies that are different between the various clients.

“I wanted to check if there was an open source solution out there that we could test before buying it. To be honest, I wanted to see if I could rebuild it myself,” Guy details the beginning of looking at external solutions, “but as soon as I found Mongoose via Stack-Overflow, I immediately loved it!” Important to him and the RocketUncle team was simple code and easy implementation of the embedded web server. They wanted to be sure that, should any bugs ever arise, they could fix the code themselves in a matter of hours rather than waiting on a third party for a fix.

Working with Mongoose

“The implementation was three basic steps: 1) take the example server code, 2) copy it to your program, 3) tweak the responses a bit and you are done! It took less than 2 hours from the moment we downloaded the library until we had the server up and ready, replacing Apache2 completely,” this simple process explained by Guy can work for anyone running C++ code on a server looking for a solution that is less work than a standalone HTTP server.

Working with the embedded web server Mongoose has turned out smoothly for RocketUncle. The implementation was quick and since then it simply runs. When using Apache2, there was always something to take care of: “Now, since we finished integrating the server into the C++ code with Mongoose, we haven’t had to touch or even think about the server. It just works. Other than the 2 hours it took to integrate, we haven’t had to even think about it. That leaves us with a lot more time to work on what’s actually important: the algorithm itself.”