Showing posts with label ecommerce. Show all posts
Showing posts with label ecommerce. Show all posts

Monday, July 22, 2019

The goal

The goal is fairly straight forward:
build the fastest ecommerce platform

Of course, this can be defined in numerous ways.

Since it'll be a work-in-progress the first milestone will be to power the ecommerce that we will launch on Daje Gård where we'll be selling plants, tree, seeds and similar things.

One could assume that just using React (or similar) would make the site fast, or at least appear fast. And this is true, to some extent.

But I'm aiming a few notches higher. Even if React is fast, it's still around 106 kB to load. Maybe Mithril is a better option, to make the first page load faster?

And even if the rendering is fast, the backend needs to be able to keep up.

The database of the ecommerce I've run for over 10 years is not even 2GB in size. And that includes old products no longer visible and everything else that isn't used on a daily basis. It could easily fit in RAM (with copy on disc).

Which led me to Mnesia. After a few simple tests, Mnesia seems to be the database to use for data that is used very often (products, top lists and similar things).

It's difficult to properly define "fastest ecommerce platform". Maybe I should change it to "the ecommerce platform made up of the fastest components I can find"?

The background

I started out my web development journey the year 2000 with PHP. Since then I've worked on everything from simple lead generation pages to ecommerce in various forms.

More or less since me and a friend started an ecommerce business in Sweden I've wanted to create my own platform/solution, but time has never been available. Or maybe it would be more correct to say that I didn't have anything new to bring to the table.

During my 11 years running this business, a lot of focus has been on optimizing things. Every second an employee spends waiting or having to click more than necessary, is money lost. This thinking has been applied to the warehouse as well, trying to optimize every step of the "print-pick-pack-send"-routine.

Platforms have launched and faded, some are still around.

When we started out osCommerce was all the hype and I spent some hours trying to make it work, but it was as horrible as I expected.

As of 2019 the main open source contenders seem to be Magento, PrestaShop and WooCommerce. I have of course tried them all but never been impressed.

Magento is and has always been slow. A lot of people say that you can optimize it and I'm sure that's true, but that's not what I want to spend my time doing. Speed is something I should be able to take for granted.

The first and only time I tried WooCommerce was a year ago. Since it was 2018 and the idea of international ecommerce was fairly old, I (naively) assumed there was a standard way of doing it. And that it was made for it. But no, plugins were needed and they didn't fully function together and if they did, something else broke.

PrestaShop is faster than Magento but still slow. And upgrading or installing plugins seem to create a small hell.

Maybe plugin-hell exists everywhere because it can't be done in some resonable way? I don't know, yet.


New technologies have seen the light of day but few have impressed or inspired me, until recently.

I thought I'd get my skills up to date and started looking into what has been released the last few years. For some reason I stumbled upon Erlang and its description:
"Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance."
.. really hit a nerve with me.

Concurrency is a beautiful word, which seems to be fairly unused in the web world. Except for serving different pages. But not for processing data to be sent back to the client.

NodeJS and async seem to be looking in the direction, but it's fairly new/unused, as far as I can tell.

After diving into Erlang texts the natural path seemed to be to find Elixir and Phoenix.

Mnesia vs Postgres - a very very simple benchmark

At this stage, part of the solution seems to be a mix of Mnesia and some RDBMS, Postgres for example. Data that is accessed often can be ...