Perl to Go


We recently moved some of our services to golang for the sake of performance and maintainability. Our large portion(80%) of application is written in perl. Perl being dynamic language + monolithic style of coding sometimes become concern for us as it leads to slow deployments and vulnerability.

We figured out some of our http API which were problematic in terms of latency and uptimes. The movement was cumbersome as it involves mapping each and every use cases to the new application. We maintained 100% API compatibility with the perl code, so that we could switch to and fro incase of any mishap. The switch was through nginx upstream module.

But the conversion seemed worthwhile after we looked at the datadog graphs which we use to measure the uptime/latency.

Some of the benefits we achieved through this activity -

  • Achieved 3x to 5x times improvement in latency - In some of the places (where concurrency was possible) we relied upon goroutines

    *blue representing latency when served from golang, red represent latency when served from perl

  • Lesser load on DB - Soon after switching to golang we observe that load average dropped.

    *blue representing load when served from golang, red represent latency when served from perl

  • Lesser load on server - There was lesser load over the application server. In some case we did cut down the number of machine.

  • Lesser machines - We used 2 Go servers each of 1GB memory and 1 core CPU. Earlier we had 5 perl servers each of 4GB and 2-4 core machine. This was undoubtedly an eye opener.

We have a bunch of good and responsible engineers in our team who made this possible. Kudos to the team!

So moving to golang was fruitful. Now we are looking forward to actively use golang in most of our new developments.