Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Ucommerce Scalability Options

Ucommerce has several scalability options to achieve better performance as the demand increases.

The Ucommerce environment can be configured as:

  • Standalone, all roles on one machine.
  • Split, one, some or all roles have its own machine.

Every environment role can achieve better performance by:

  • Scaling vertically
  • Scaling horizontally

Environment Roles

Ucommerce environment has the following roles:

  • SQL Database Server
  • RavenDB Server
  • NHibernate 2nd Level Cache Server
  • Web Server

Standalone machine for all roles

By default, all roles run on the same machine. This is great for development environments, as you are up and running in no time.

For a production environment, this can be a problem if the machine does not have enough resources. Since all the roles compete for the same resources (CPU, RAM, and DISK), any one of them can starve the others.

Scaling Vertically

“To scale vertically (or scale up) means to add resources to a single node in a system, typically involving the addition of CPUs or memory to a single computer.” (Wikipedia)

This is the easiest way to achieve better performance. Ideally, do a profiling to figure out what kind of resource the environment is running low on.

Split one/more/all roles to their own Machines

Ucommerce offers a gradual way of moving roles to their own machine. You can start with one and move additional roles to free up resources as needed.

Moving SQL Database Server to its own machine

SQL Server is usually very resource intensive, and moving it to its own machine is usually a good first step. Just move the Ucommerce database to the new server and change the connection string in web.config on the Web Server. Read more here.

Moving RavenDB to its own machine

Ucommerce uses RavenDB for full-text search, facets and to speed up the performance of queries. By default, Ucommerce uses an embedded version that runs in-process on the Web Server.

Moving from the embedded version to a full instance running on its own machine is fairly easy. See Run RavenDb as an external application in our documentation All the data will be created on the new server after the indexer is finished.

Moving NHibernate 2nd Level Cache to its own machine

Ucommerce caches Data Entities in a shared cache, this is by default run on the Web Server.

The NHibernate 2nd Level Cache is provider-based, and Ucommerce uses SysCache as the default provider. SysCache uses the ASP.NET cache by default that uses the Web Servers memory.

To free up RAM, this cache can be moved to its own machine. Using one of the other providers (MemCached, NCache etc.) Just change the cache provider in web.config on the Web Server and point it to the new provider server.

Web Server

This leaves the Web Server using all the available resources, for serving web requests.

Vertically Scaling a Split Role per Machine Environment

Each of the role machines can individually be scaled vertically. If the bottleneck is the SQL Server, adding more resources to it would make sense up to a certain point. If the Web Server does not handle enough requests, adding more CPU or RAM will help increase performance. If the RavenDB search results are too slow, adding more resources will help.

Horizontally Scaling a Split Role per Machine Environment

Scaling vertically can be increasingly expensive since better hardware in a single machine gets incrementally more expensive.

The technologies (SQL Server, RavenDB and many of the 2nd Level Cache Providers) used by Ucommerce supports horizontal scaling. It is out of scope for this article on how to do this, please reference their respective documentation.

Horizontally Scaling of Ucommerce on the Web Server

Ucommerce running on the Web Server can be distributed to multiple machines, as long as any shared state is kept at a single source of truth. Shared state co-insides with the Roles (SQL Server, RavenDB and NHibernate 2nd Level Cache), and needs to be accessible from all Web Server machines.

It is possible to horizontally scale the Web Servers, without scaling any of the other roles. You could set up a single machine with SQL Server, RavenDB and NHibernate 2nd Level Cache, and then add multiple Web Servers all pointing to that machine.

Summary

Ucommerce has many options for improving performance and support scaling (both vertical and horizontal) and split per role out of the box.