Think Straight

ยท

2 min read

Now what i am going to share is kind of a roller castor story, So be ready for it ๐ŸŽข.

Happy Phase:

Few days back, I was working on 1 XYZ project something that is particularly on "Billing Reports Generation"(Where I was creating the CSV, PDF and HL7 Files once the user reaches particular threshold). Done with code and deployed it to the DEV environment and QA team tested for few days and everything was working pretty well.

Problem Phase:

So pushed the code to PRODUCTION environment, Everything was cheerful so far, there comes a day where suddenly reports generation was STOPPED!!, No idea Why it happened.

Started to dig the hole deeper, Unable to find any clues, Code wise everything is fine but still problem persists only in PRODUCTION,
Started to break the heads ๐Ÿคฏ, As usual we has a dev team started to blame devOps team(Something like IMPROPER DEPLOYMENT).

Solution Phase:

After several hours of investigation, got to know that in DEV instance, we were using 4GB of RAM, where as in PROD instance we were using 1GB RAM, Thought that finally got the problem but still not, checkout Twist phase.

Plot Twist:

Even after increase of RAM in PROD from 1GB to 4GB, still we were unable to generate the reports. Again started to deep dive and after several days of investigation found out that QA team generated humongous of data, Due to which we found out that it was not able to generate CSV, PDF and HL7 Files in the backend.

Reason: HUGE TIME COMPLEXITY

Points to remember:

Always use below properly in backend, no matter which TECH STACK you use:
1. Never write/read an entire file into the memory synchronously, instead do it through streams.

2. Add proper indexes to your tables for faster access

3. Design your entire system before even writing your first line of code.

Conclusion:

  1. Always do the Stress/Load test of your code to make it more quality code.

  2. Use of Proper Data structures and Algorithms.

  3. Always THINK STRAIGHT because here if we had checked the DB at initial day then that would save a lot of time for us.

  4. Never blame other teams ๐Ÿ˜….

ย