Ë
Explore Our Blogs
Things to Keep in Mind While Building Large-Scale Solution
By Shyam V
Things-to-Keep-in-Mind-While-Buildin-a-Large-Scale-Solution

Corporations of all sizes have to explore scalability while designing applications. Organization should plan for scalable enterprise architecture to take into consideration growth, and standardize business processes. However, merely developing architecture doesn’t guarantee successful delivery. When building large-scale solutions, it’s easy to run into operational issues – new features take longer to add, code is harder to test, difficulty in matching local and production environments etc. Following are some success factors to keep in mind when building large-scale solutions.

Avoid complexity
When building large-scale solutions, perhaps the most important thing is to start with a view to avoiding unnecessary complexity. The goal of scaling should be to make the web stack work less for common requests. This means doing the following:

  • Avoiding complex operations in the request-response cycle
  • Storing results of common operations to not repeat work
  • Reusing data that is already looked up

These require some form of caching. Not only is adding memory to a server inexpensive, it’s significantly faster for accessing data when compared to the network.

Hosting Topology
Be it the cloud or hardware where your application is hosted, some part of your stack is bound to fail. This should be taken into account while hosting your web servers. The domain should ideally point to a load balancer that routes requests between servers, to make surviving failures and handling increased load easy. With a load balancer in front of two web servers, the application can be scaled horizontally by putting new web servers behind the load balancer, this spreading the requests across more machines. Thus, the application grows gracefully over time as it is able to handle temporary surges of traffic.

Cache Database Queries
Typically, there are a few common queries that make up the majority of the load on a database. Most databases support query logging. Moreover, there are tools that ingest logs and run an analysis for which queries are run most frequently and which take the longest to complete. All you need to do is cache the responses to frequent or slow queries to have them implanted in memory on the web server. However, cached data can get old quickly if the underlying information is frequently updated. It depends on your business or product requirements to define what can or can’t be cached.

Continuous Integration
Having a Continuous Integration (CI) and Continuous Delivery (CD) system is especially beneficial for projects that require a timely delivery of builds. Instead of monotonous tasks such as testing, building and deploying, developers can focus on building out features. Much like a conveyor belt with three steps: testing, building and deploying, CI and CD make it possible to deliver results incrementally.

Session Storage
Many applications handle sessions by storing a session ID in a cookie and the actual value data in a database table. If you find your application does a lot of reading and writing to session data, rethink your session storage.

You could move your session storage to a faster, in-memory caching tool like redis or memcached. Because these use volatile memory instead of persistent disk storage, they’re much faster to access. The catch is, you run the risk of losing all of the session data if the caching system needs to reboot or go offline. Or you could move the session information into the cookie but this leaves it vulnerable to being tampered with and shouldn’t be used for storing sensitive information. Moving session data out of the database will eliminate several database queries per page load, boosting your database’s performance.

Run Computations Offline
If you have long-running queries or complex business logic, avoid running it in the request-response cycle during a page load. Instead, have it offline and make the workers put the results in a database or in-memory cache. Thus, when the page loads, the web server can simply and quickly pull the precomputed data out of the cache and show it to the user.

Final words
Regardless of the layers of security, complete security isn’t guaranteed. Some of the best practices to follow include password hashing, JSON web token, cookies/session expiry. However, with the right approach to building large-scale web applications, enterprises can truly scale and lay the foundation for growth.

About The Author

Shyam V

Shyam Visamsetty is founder & director at Navtech, a technology consulting company with widespread experience in building platforms with high-velocity project teams. He is the technology & entrepreneurial enthusiast who likes to provide technology solutions for core problems. He pursued his masters at Virginia Tech specializing in Software Engineering process management & has tremendous experience in Project & Product Management.