One of the perks of microservices architecture is the flexibility to “use the right tools for the job.” For developers who want to experiment with different programming languages and frameworks, their microservices can still play nicely with other microservices built with different stacks thanks to microservices’ independence and well-defined APIs.
This flexibility also applies to database choice. Monolithic commerce applications must run on top of a single, monolithic database. For most enterprise commerce applications, this means a relational (SQL) database. While SQL is the database architecture of choice for many components of the commerce system that deal primarily with structured data, it’s poorly suited to handle the unstructured data involved in modern commerce experiences.
Structured vs unstructured data
Structured data is single-entry information that fits neatly into a SQL database’s matrix of columns and rows. For example, first name, last name, address and email; or inventory, transactional records and point balances. Unstructured data includes images, videos, blogs and articles, product reviews, personal settings, location-based information, usage metrics, graph and clickstream data.
While SQL databases can store unstructured data, it’s not ideal. For example, the full text of a blog entry is stored within a single database cell. Associated images or videos must be stored in their own relational tables, and a structured query instructs the commerce application on where to fetch this data and reconstruct it for the user. This can slow down site performance, complicate development and create a large and complex database with inefficient data storage and many “null values.”
NoSQL for unstructured data
NoSQL databases such as MongoDB are a newer class of databases that are designed to handle unstructured data, accelerate development and enhance application performance. Unlike SQL’s structured schema of tables and rows, NoSQL supports dynamic schema, meaning developers can modify database schema without having to consider the complex relationship between tables and build features without constructing complex SQL queries.
Catalog and Merchandising are two examples of microservices that benefit from NoSQL. New product types and attributes can simply be added to documents, rather than create new tables and inflating database size. Flexible attributes enhance merchandising, support advanced, product-specific filtered and faceted navigation and make creating new, thematic categories a cinch.
Designed to handle unstructured data, NoSQL databases support modern experiences that involve graph, trending data, personalization, user-generated content, AI, social, third-party and Big Data. For example, Barnes and Noble’s Book Graph is a novel way to explore their catalog based on “unexpected connections” between titles. Incorporating social, sales and clickstream with rich product attributes, Book Graph is an interactive way to merchandise for a retailer that competes head-to-head with Amazon in its category.
With lighter code and object-oriented language, document store databases can fetch unstructured data much faster than SQL, making customer experiences more performant.
The advantages of micro databases
Despite the benefits of NoSQL, relational databases are still the gold standard for transactional data and data that are critical to real-time reporting, such as Checkout, Order Management and Inventory. Microservices architecture allows you to use the best database for any given service without compromise, which is why the Skava Commerce platform is built with both SQL and NoSQL databases.
Relational data within a monolithic database must reside on a single logical server. For large, enterprise monolithic platforms, there’s only one way to scale — vertically. As the application and data grow, the database must fully migrate to a bigger (and often expensive) hardware. This also impacts performance. If one area of a monolithic database slows down (or fails) the entire application and user experience is affected. Microservices are independently scaled, and services running on NoSQL databases can leverage commodity servers for cost savings.
Want the best of both worlds?
To learn more about how Skava microservices can help you deliver innovation faster and boost performance, get in touch. And for more practical applications of microservices for ecommerce, check out our latest webinar.