DEV Community

Discussion on: When do you know the performance bottleneck is not your code, but the infrastructure?

Collapse
 
rhymes profile image
rhymes

Upgrading the infrastructure will definitely improve performance, but at a financial cost

Well, spending N developer days measuring and optimizing will probably cost you money anyway.

It depends on the tradeoff and the issue. If you have a slow query and the solution is an index you obviously are not going to gain much by upgrading the amount of RAM on your database server. If the issue is "two nodes are too slow to process these images" you either rewrite the function to make it faster or you add nodes to finish earlier. How to decide? Depends on the expertise available, time to market, if it's a one off and so on.

If it's going to take your devs a month of no features because they have to learn a faster language to process images when with a few dollars you can spin up a bunch of functions or machines to accomplish the work with your current language... I would focus on the second. Obviously the suggestion would be the opposite if your entire business is selling image processing :)

If you have a business running on a Rails app that occupies 600 MB (arbitrary example) and your tier is 512 MB, you're probably better off upgrading to 1 GB of RAM than halting development of bug fixes and new features for an indefinite amount of time to find a way to shave off 100 MB of RAM. You still should probably do it, but maybe not while you are focusing on a more mission critical part of your app.

There's no magical formula, it takes visibility into your system, monitoring, measuring and expertise.