Magento Microservices and Node.js

In Magento 2 every new feature gets added to the existing application using extensions making it more and more complex and slower. Scaling becomes hard and resource-wasting since everything has to be scaled together. Deployment turns into a nightmare thanks to the 5 million PHP lines of code waiting to be pushed into production every time, di compile, setup, upgrade, static content deploy, cache clean…

Magento Core, Extensions, Theme version update is another sad story

The impact of microservices on eCommerce — Sander Mangel

Being in eCommerce for over 12 years, Sander has gained amazing experience as a developer, tech lead and now as an evangelist of modern technologies. Along with our host, Marcos Bravo C., they explain the concepts of microservices, headless and service-oriented architecture (SOA), and how they’re changing the environment of eCommerce. They also take a look at the leading eCommerce platforms, like Magento, Shopware or Hybris, their adoption of the headless approach and other modern technologies, and why some of them were bought recently by software giants.

After a certain complexity, it becomes difficult to handle even the smallest changes in the Magento enterprise environment.

To solve this problem you can use an eCommerce microservices architecture

In a microservice-oriented architecture, Magento features can be built up from multiple smaller pieces (cart, order, product, category, search, review) that work together but can be developed separately. By defining technology-agnostic communication channels, any language can be used PHP, NodeJS, Python, Rust, GO. This means that developers are not restricted to legacy technologies anymore, and they can freely just develop

If done properly, a microservice should be small enough to be rewritable in about two weeks by a single person.

But what makes Node.js the best option out there to build Magento's tinny services?

Image for post
Magento Node.JS

Node.js and Magento.

Node.js became the go-to technology in the past years for both startups and enterprises who decided to embrace microservices.

Well, some argue that Node.js increased the productivity of their teams, and some will say their application became blazing fast or that their developers are happier with Node.

In fact, all of these claims are true, here’s why:

Productivity: The package manager for Node.js, npm has an incredible amount of modules that can be used instantly, which saves a lot of development effort. Also, as Node.js applications are written using JavaScript, front-end developers can easily understand what is going on and make changes if necessary. Since developers can use the same language on the entire stack and the very same modules in the frontend and in the backend, an incredible amount of time can be saved.

Performance: Node.js is one of the best solutions for creating high-performance, real-time web applications, thanks to its non-blocking, event-driven I/O model (parallel MySql/Redis queries execution). Combined with a microservice-based application, it can handle an extreme amount of Magento load with low response times (TTFB). By properly utilizing microservices and Node.js, it’s possible to handle the same load with only 5% of the hardware.

Magento Developers Happiness: Node.js is spreading like an unstoppable virus with its 3.5 million users and 100% annual growth rate according to the Node Foundation. Its module system — npm — is much more popular and grows significantly faster than the package managers for other languages often used in an enterprise environment.

Highly innovative Magento enterprise clients like Lego, Nike, Walmart already know that Node.js and Microservices are a great combination for achieving high performance, increased productivity, reduced costs, and satisfied developers.

The love affair with Amazon’s serverless offering since then has blossomed. Not only did we save a ton of money for the merchants by reducing wastage and DevOps a Magento Cloud Hosting cost but we were able to really embrace the Node.JS microservices architecture completely and Magento servers could now focus on their real job — render catalog pages rendering.

Image for post
Magento + Lambda

If you are interested in Magento Serverless microservices fill free to email me:

Using a Magento microservices architecture leveraging AWS’s Lambda we achieved :
1. Keep infrastructure costs down for our clients — We were able to keep infrastructure costs for our clients as low as possible. We work with a lot of early-stage eCommerce startups and every dollar is precious. The pay per use model with zero upfront costs helps startups save costs and deploy those resources in building features and responding to customer needs rather than worry about paying their monthly infra bills. time (and money) on DevOps tasks like rolling out EC2 instances, setting up auto-scaling, monitoring, looking at budget overruns, and let our DevOps team focus on adding value by Continuous Integration.

3. High-Level Code Reuse — Lambda functions take code reuse to a new level — now if we needed to say implement a feature to resize an image or create a pdf from an Invoice, Punchout or any other type of Magento — 3d party system integration we just called an API that we had created for an earlier project. Add to that, the microservices architecture makes this technology agnostic, so I could have a team working on a Magento PHP project called a Lambda function that was created on NodeJS or Go language without worrying about deploying to another server, etc..

Magento 2.3.4 GraphQL vs RestAPI vs Serverless Lambda Microservice performance

Written by

Magento/APP Cloud Architect. Melting metal server infrastructure into cloud solutions.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store