You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where third-party utilities are used, are returning errors being caught?
Remove any commented out lines.
Function length: For a method above 50 lines, it should be cut into smaller pieces.
Number of method arguments: For the methods and functions, do they have 3 or fewer arguments? Greater than 3 is probably a sign that it could be grouped in a different way.
Some endpoints should be idempotent (Should not do anything if called twice)
Make parallel request for fast processing
Naming a new function → Check if it is defined before or not
Don’t make/calculate X if x is getting used multiple times, instead declare it
Reduce the scope of Action by adding Checks. Like action on a particular status
Use single resource pool per application
Use not (!) to your advantage by not writing many ==
Don't forget to free the resource. Clear resource in finally statement if necessary
Release resource as soon as they are not required
Reuse resource, don't just create new ones every time
Refresh resources over time, they tend to hog on to memory with time
Know your resource usage limits. The min and the max
Have alerts in place for resource shortage. We can have multiple alerts
If possible dedicate/limit resource tied to a process
Caching
Add caching wherever applicable.
Don't forget to define action points to invalidate cache (on upates/delete and in some cases inserts)
Use memoization whereever applicable for CPU intensive functions
Model your data precisely. hashmap, string, boolean etc
Think of what should happen if the same function get called with same input
Production Bug
Try to look for patterns in the faulty set
If problem is still there, stop/fix it immediately. Look for what damage has been done. Look for how to minimize the damage. Look for other problems that might arise due to this. Fix the damage. Think about where we lacked. Make sure that this doesn't happen in future.
If nothing works, just Restart the server, restart everything :P
Third Party Integration
Test the PROD APIs before releasing
Always deal with domain names and not IPs
Use HTTPS
Have AUTH protected APIs on both sides for example some third parties take callback url this API should be Auth protected
Check for IP filtering
Have sandbox server to test
Prod and Stag AUTH should be different
API contract for PROD and Stag should be same. i.e they must run on the same code
Have API retries on failures
Deine mechanism after final failure occurs
Use statuscake/pingdom to get health checkups for 3rd party API downtime
Check if there is a rate limiting for APIs
If your data is being shared by a file url, make sure the url is not guessable and rate limited
Know exactly when retries will happen for example if you send a non 2XX code most 3rd parties will retry and you might not need that retry to overload your servers OR you don't want to retry if you receive 400 bad request as it will always result in a bad request
Taking any data from 3rd party in a file, upload it to your database/file utility service for future use
Database
Create index for keys in where query
Create index for keys in order by
Decrease the span of the query filtering or sql query by adding a indexed field conditions like if you know that your results are after a certain date and date field is indexed then add that date filter to the query