Using a Microservice to extend the lifespan of old apps
If you have an old app that works, but it has some problem spots, it might make sense to use microservices to fix these issues.
Sometimes rewriting core modules or classes in an old app, is just not feasible. In these cases, using a microservice to bypass the old code is the way to go. This strategy can work wonders in breathing new life into an app, saving you the cost and headaches of writing a brand new app from scratch.
Bypassing the Apps old ORM with a much quicker ORM
As an example, we recently fixed a huge speed issue (with an old app) that was using an old slow ORM. An ORM is a layer of code, used to interact with a relational database. ORM is short for Object Relational Mapping … just in case you don’t know.
So we used the micro-service pattern (strategy,) to leverage a new faster ORM.The end result: records that took minutes to load, now loaded in 1-2 seconds!
Sometimes you have to break the nerd-rules
We had to duplicate some fields in the database (typically a big no-no,) to make this work. But by using database transactions and database triggers (to keep up the data integrity,) it made sense to break these rules in this situation.
… Besides, these were fields whose value rarely, if ever change.
We deployed Sunday night (as usual) just in case something went wrong on the live server. I am happy to report, all went well.
Stefan Mischook
Killerphp.com
Comments