8
Angry
4y

A few weeks back we ported our PHP Rest API into a couple of Go micro-services.

Incredibly _satisfying_ job.

Requests went from 20+ seconds to ~100-300ms.

There was still one bottle-neck, though, because we had to use most of the old cluster-fork of a database (because no way I'll be able to fix all that in a week).

And ooh, next we're thinking of switching to gRPC. Man, we have the best jobs.

Comments
  • 6
    Well honestly, that big of improvement looks to me more like poorly written codebase beforehand than optimization gain from switching the languages.

    Could you shed some more light on this, am geniualy interested 🤔🤓
  • 5
    Wtf was that php api doing?
    Wtf isn't the Go api doing anymore?

    One doesn't just get that kind of performance increase if it's doing the same thing, yes Go is faster but if it's connecting to the same database(s) and executing the same queries, then either the php api was built by someone with no clue on performance, or the database queries have been rewritten or moved to a new DB.

    I've got a feeling this was a few very poor DB queries behind the scenes.
  • 0
    @myss @C0D4 I have had a similar result once due to the workload parallelization. In PHP it was not doable because of some 3rd party global state issues. Not as drastically as this but none the less from seconds to about 100ms
  • 3
    @myss It really was just that; very poorly written code.

    It was really old code, too. Something like 11 years, a total mess. It somehow contained both Zend 1 and 2 frameworks, AND spaghetti code.

    It used a custom built ORM that pretty much remain unchanged in it's 11-year existence.

    @COD4 - we used /most/ of the old database but we didn't run the queries. The PHP code had shit like "select something and then loop through the dataset in PHP to map them into an object" built into the ORM.
  • 3
    @Angry ah, shit burger code 😅

    See this makes more sense now.
Add Comment