Top Banner
Scaling an eCommerce environment Beyond Magento
52

Scaling an eCommerce environment

Apr 14, 2017

Download

Technology

Sander Mangel
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Scaling an eCommerce environment

Scaling an eCommerce environment

Beyond Magento

Page 2: Scaling an eCommerce environment

Sander Mangel- Worked at several web agencies

- Currently working as Technical Lead at FitForMe

- 10 as PHP developer, 5 years as Magento developer

- MageStackDay, Rotterdam MUG, Meet Magento NL

- sandermangel.nl / @sandermangel

Scaling An Ecommerce Environment @sandermangel

Page 3: Scaling an eCommerce environment

FitForMe- Food supplements for bariatric patients

- Magento EE 1.14.x

- 13 websites (countries) in 1 installation

- > 1000 orders per week via webshop

- Rest via telephone, agents, resellers, pharmacies

Migrating to Magento 2 - As a Merchant @sandermangel

Page 4: Scaling an eCommerce environment

Fulfillment- Warehouse in The Netherlands

- Warehouse in the UK soon active

- Resellers on other continents Q4 2016

B2B orders are booked directly into the ERP system

B2C orders via Magento

Scaling An Ecommerce Environment @sandermangel

Page 5: Scaling an eCommerce environment

Basic outsourced order fulfillment

Scaling An Ecommerce Environment @sandermangel

Page 6: Scaling an eCommerce environment

Expanding requirements

Scaling An Ecommerce Environment @sandermangel

Page 7: Scaling an eCommerce environment

Fulfillment integrated in Magento- Extracts data from the order & customer object

- Performs some address checks (formatting and validity)

- Creates an XML to send to the fulfillment company by FTP

- Determines the type of shipping box

- And some other magic that fixes/patches order data for fulfillment company

Scaling An Ecommerce Environment @sandermangel

Page 8: Scaling an eCommerce environment

Expanding requirements

Scaling An Ecommerce Environment @sandermangel

POS for pharmacies, events, hospitals and sales agents

ERP for B2B, exotic countries and Bulk orders

Promotions, loyalty gifts, etc

Page 9: Scaling an eCommerce environment

Something like this

Scaling An Ecommerce Environment @sandermangel

Page 10: Scaling an eCommerce environment

Magento as the shipping platformMagento > Warehouse 1

Magento > Warehouse 2

Magento <> Shipping Contract Manager

ERP <> Magento

POS <> Magento

Dotmailer > Magento

Scaling An Ecommerce Environment @sandermangel

Page 11: Scaling an eCommerce environment

Magento as the shipping APIRequires a full order, invoice and

shipment to be made in Magento.

No guarantee for a stable API, if Magento

changes (modules, updates, etc) the API

breaks

Magento 2 compatible? Probably not...

Scaling An Ecommerce Environment @sandermangel

Page 12: Scaling an eCommerce environment

Magento sucks at doing everything

Scaling An Ecommerce Environment @sandermangel

Page 13: Scaling an eCommerce environment

Magento sucks at doing everything

But excels at being an online catalogue & checkout

Scaling An Ecommerce Environment @sandermangel

Page 14: Scaling an eCommerce environment

Use Magento for its purposeMagento as a slow, resource heavy

eCommerce platform should never be

used for anything else than being an

online catalog and ordering system,

which is cached and optimized either out

of the box or through a couple of tweaks.

Scaling An Ecommerce Environment @sandermangel

Page 15: Scaling an eCommerce environment

Using Magento for the rest- Restricted by Magento

- Creates overhead

- Tightly coupled

Generally, it takes more effort to make it

work with Magento than to actually build

the feature.

Scaling An Ecommerce Environment @sandermangel

Page 16: Scaling an eCommerce environment

The agency way- Projects are normally done with 1 framework

- Features are made to fit the technical solution

- Scalability is relative

- Only keeping in mind project scope

- Just make it work for now, changes can be done in a later project

- Make sure all hours are billable

Scaling An Ecommerce Environment @sandermangel

Page 17: Scaling an eCommerce environment

Meeting a merchant needs- Scope changes as the business grows

- Build features to be easily replaceable, all code is expendable

- Think outside of frameworks, budgets and scopes defined by business

- Should be affordable even when doing high volumes

- Applications should be build modular and movable

Scaling An Ecommerce Environment @sandermangel

Page 18: Scaling an eCommerce environment

Make it a Microservice!

Scaling An Ecommerce Environment @sandermangel

Page 19: Scaling an eCommerce environment

Make it a Microservice!

Well… Microservice-ish

Scaling An Ecommerce Environment @sandermangel

Page 20: Scaling an eCommerce environment

"In computing, microservices is a software architecture style

in which complex applications are composed of small, independent processes

communicating with each other using language-agnostic APIs."

— https://en.wikipedia.org/wiki/Microservices

Scaling An Ecommerce Environment @sandermangel

Page 21: Scaling an eCommerce environment

Ah right, so what does it do?An application and underlying infrastructure specifically designed and optimized for

one task with an API interface allowing other systems to communicate with it.

Scaling An Ecommerce Environment @sandermangel

Page 22: Scaling an eCommerce environment

Ah right, so what does it do?An application and underlying infrastructure specifically designed and optimized for

one task with an API interface allowing other systems to communicate with it.

or in the case of the FitForMe Fulfillment module…

An application that creates properly formatted shipment orders really well.

Scaling An Ecommerce Environment @sandermangel

Page 23: Scaling an eCommerce environment

A different approach

Scaling An Ecommerce Environment @sandermangel

Page 24: Scaling an eCommerce environment

Where to start- Write down what business logic should be moved to the Microservice

- Document the API interface. What data will be send

- Pick a framework to build it in

- Set up an environment to run the Microservice.

Scaling An Ecommerce Environment @sandermangel

Page 25: Scaling an eCommerce environment

Bonus tips- Keep it simple

- Stick to what you know

- Do read up on microservices

- Pick a simple module that has minimal coupling with Magento

- Document, Document, Document

Scaling An Ecommerce Environment @sandermangel

Page 26: Scaling an eCommerce environment

Requirements for a framework- Low learning curve

- Built on PHP and compatible with NginX, PHP 5.6 and up

- Fast & lightweight

- Has an API layer built in

- Has a testing framework built in

Scaling An Ecommerce Environment @sandermangel

Page 27: Scaling an eCommerce environment

Requirements for a framework- Low learning curve

- Built on PHP and compatible with NginX, PHP 5.6 and up

- Fast & lightweight

- Has an API layer built in

- Has a testing framework built in

Scaling An Ecommerce Environment @sandermangel

Page 28: Scaling an eCommerce environment

Basic Magento model

Page 29: Scaling an eCommerce environment
Page 30: Scaling an eCommerce environment

Extracting Magento data in models

Page 31: Scaling an eCommerce environment
Page 32: Scaling an eCommerce environment

Logic in loosely coupled classes

Page 33: Scaling an eCommerce environment
Page 34: Scaling an eCommerce environment

Set up the Database table

Page 35: Scaling an eCommerce environment
Page 36: Scaling an eCommerce environment

Define the API interface

Page 37: Scaling an eCommerce environment
Page 38: Scaling an eCommerce environment

And set up a cronjob

Page 39: Scaling an eCommerce environment
Page 40: Scaling an eCommerce environment
Page 41: Scaling an eCommerce environment

So that's it

Scaling An Ecommerce Environment @sandermangel

Page 42: Scaling an eCommerce environment

So that's it

Or is it?

Scaling An Ecommerce Environment @sandermangel

Page 43: Scaling an eCommerce environment

Whats next

Scaling An Ecommerce Environment

- Better infrastructure

@sandermangel

Page 44: Scaling an eCommerce environment

Whats next- Better infrastructure

- Management Layer

Scaling An Ecommerce Environment @sandermangel

Page 45: Scaling an eCommerce environment
Page 46: Scaling an eCommerce environment

Whats next- Better infrastructure

- Management Layer

- Using event driven hosting

Scaling An Ecommerce Environment @sandermangel

Page 47: Scaling an eCommerce environment
Page 48: Scaling an eCommerce environment

Whats next- Better infrastructure

- Management Layer

- Using event driven hosting

- Build more services

Scaling An Ecommerce Environment @sandermangel

Page 49: Scaling an eCommerce environment

Whats next- Better infrastructure

- Management Layer

- Using event driven hosting

- Build more services

- URL shortener

Scaling An Ecommerce Environment @sandermangel

Page 50: Scaling an eCommerce environment

Whats next- Better infrastructure

- Management Layer

- Using event driven hosting

- Build more services

- URL shortener

- Subscription order generation

Scaling An Ecommerce Environment @sandermangel

Page 51: Scaling an eCommerce environment

Whats next- Better infrastructure

- Management Layer

- Using event driven hosting

- Build more services

- URL shortener

- Subscription order generation

- ...Scaling An Ecommerce Environment @sandermangel

Page 52: Scaling an eCommerce environment

Thank you

Sources

Microservice in generalhttp://microservices.io/patterns/microservices.htmlhttp://martinfowler.com/articles/microservices.html

http://blog.eventuate.io/2016/01/27/microservices-more-than-just-infrastructure/Microservice in Magento

http://fbrnc.net/blog/2015/10/super-scaling-magentohttp://alankent.me/2016/01/15/microservices-and-magento-quick-note/

https://firebearstudio.com/blog/microservices-ecommerce-magento.htmlAPI in Lumen

http://laravelista.com/build-an-api-with-lumen-and-fractal/

slideshare.net/SanderMangel/scaling-an-ecommerce-environment

Scaling An Ecommerce Environment @sandermangel