Knowing how to build a fast scalable architecture that supports your ecommerce is as important as the products and content that you host.
How you build your ecommerce site is important to your online business success. You want your capacity to grow with your business, You want to be fast. You want to convert customers and have them complete their shopping cart checkout.
Slow sites can impact your sales, page views, conversions, bounce rate, search ranking and even result in abandoned shopping carts. If you can’t scale your operations then site performance and sales will suffer. In fact, a study by University of Nebraska-Lincoln found that most people won’t wait for more than two seconds for a web page to load.
There are dozens of ways to improve your ecommerce site scalability and performance. Here are just a few of the great ways to get you started.
First, write down some of the key metrics and features of your ecommerce site to get a baseline for your requirements:
Now, with those key stats in mind, let’s look at how we can improve some of the main components of your ecommerce system. This way, we can make your site faster and more scalable.
Btw, having your servers located closer to your users means less network distance for your data to travel …. which equals faster site performance.
Web servers are typically sized based on the amount of traffic and users that you have on your site. The more users, the bigger the web server size. The more transactions, the bigger the web server size.
Try to make as much of your site static and cached as possible. This is an important strategy to consider at the design stage. Inventory levels will change while at the same time you will want to balance the cached assets of your site with updated data. Look at how users use your site and then build out a solution that optimizes your site for their shopping behaviors . Consider using server side caching technologies like Varnish to cache static pages. If your using a PHP based app, use opcode caching technologies like APC.
Your choice in web server and its configuration greatly impacts your site performance. Consider using Nginx as your web server since it is shown to be as much as 50% faster in some cases than the latest version of Apache server. It was built for asynchronous transactions and is very fast at serving up static pages.
Searching your tables for product records can really slow down your website performance.
Implement a search solution like SOLR or ElasticSearch to improve search functionality speed without overloading the database. This will delegate search processes to its own dedicated solution.
The amount of product and user records in your database usually dictates how big your database server should be.
To help improve performance, consider using caching technology like memcached or Redis .
To keep things fresh, you can store queries in memory for a certain period. An example is Redis (“REmote DIctionary Server”)which is a key-value database that will store your data in memory. Another example is Memcache-d ” which is a general-purpose distributed memory caching system. Using these types of caching speeds up your dynamic assets by caching data and objects into memory. This will reduce the number of times an external data source (such as a database or API) needs to be read. More records means more memory.
For example. you can store product information in Memcached to speed up your pages. Update and expire cached data to keep it current.
Use Web Server Load Balancing
Using a load balancer allows you to scale to multiple web servers on demand, transferring some of your traffic to other servers during peak usage. You can add or remove servers as needed. For example, Amazon Web Services allows this scaling process to be automated according to CPU load or any other number of monitored metrics.
Especially when you’re first starting off, don’t try to host everything yourself. Cloud services like Amazon Web Services allow you to focus more on building your business and less upon managing the upkeep of your infrastructure.
When possible, use managed services. For example, AWS has managed databases, caching services, a Cloudfront CDN and Lambda micro services that sit outside your servers. By using any of these you will free up your application resources so that your site is much faster. Managed services help improve your site reliability and efficiency by freeing up system resources for other tasks. A CompTIA study published in CIO magazine found that improving the efficiency and reliability of IT operations was a main driving factor for many companies choosing to use managed services.
Caching Behavior of Clients
Where possible build your application so that the data will be cached on the client side. Use HTTP caching to keep files on your clients browser so that they don’t have to be transferred again from your server until the data is expired.
Retrieve and Render Data After the Page Loads
Consider using the Backbone.js library and/or Websockets to gather personalized data from your backend. The cool thing about this strategy is that your main web page is delivered immediately (possibly cached :)) while the personalized data is grabbed as needed after the client requests it and then the personalized section is rendered (after request) on the page. Using a framework like Angular.js or Ember.js are other examples of technologies that can help speed up your site. Both approaches can retrieve user personalized data as needed, like Backbone.js, and then render the page section after the initial main page has loaded.
Securing your web pages is important to safeguard transactions and accounts. But don’t over do it by securing static public pages on your website (i.e.: terms, FAQ’s and blog posts). By practice, https requires additional steps and server overhead to handle the encryption and related extra assets. The additional time is very small but just make sure you keep it to a minimum by correctly optimizing your servers https configurations.
External vendors typically require access to/from your system via web calls. For instance, you may request a tax rate quote for a region via a REST service. The more asynchronous these calls can be the better. Reserve real time end-to-end API calls and responses for sales transactions. Try to unload as many non-realtime calls into your backend fulfillment process as possible. Use of queue processing with services running on RabbitMQ and/or SQS can help take the load off your server so that you can concentrate your resources on real time transactions.
Monitoring and Updating
Enhancements and changes to make things better are only as good as the process you have in place to make sure it works correctly.
Monitoring and updating accordingly is as important as implementing these ideas in the first place.
Use a monitoring application that keeps tabs on your vital e-commerce metrics as well as your backend system metrics. There’s plenty of tools and services out there that provide managed services. Some e-commerce platforms provide dashboards for many of the key metrics for you. If you have the technical resources, then you can even build your own integrated dashboards. For example, an ELK (Elasticsearch, Logstash and Kibana) stack implementation can be used to centralize all your logs into custom dashboard to display actionable metrics.
Whatever your choice to improve your site performance, remember, your work is never complete. Many more blog posts can be written about other best practices that speed up and scale your ecommerce site. You can always make things faster and better. New technology, your code, user base, site use and software is always changing and will impact your performance and scaling needs. Changes like these will keep you on your toes while offering new opportunities for improvement on a daily basis.