Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Conversation

@Fifciu
Copy link
Contributor

@Fifciu Fifciu commented Feb 9, 2020

Hello.
I've just prepared a Varnish configuration with autoinvalidating ES. It is able to really improve your page's speed.

Request to the:

/api/catalog/vue_storefront_catalog_eu/product/_search

Without Varnish (132ms):
image
With Varnish (79ms):
image

Elasticsearch is pretty good at caching. However, let's look at extensions that fetch some data from a real backend (M2). Example of my extension that fetches menu without Varnish (791ms):
image

As you see TTFB is really huge. It is because API sends the request to Magento. So normally it goes through VSF-API -> Magento. When we use Varnish we cache it in front of the VSF-API so the response is... a bit faster! (84ms)
image

I am also wondering about caching Pull Cart request and invalidate it with Update & Delete. I have to check this idea.

Inside my PR, we have file docker/varnish/README.md there you can find every information I've prepared for developers.
https://github.com/DivanteLtd/vue-storefront-api/blob/342fe2b89ad895578cb2d9fdfdb62cffa20f6231/docker/varnish/README.md

As we have a docker image, we can easily test it locally. We just need to create the same network for each docker-compose. Usually, I run:

docker-compose -f docker-compose.nodejs.yml -f docker-compose.yml up

Then, in another terminal I run:

docker-compose -f docker-compose.varnish.yml up

So when I am experimenting with Varnish's config, I have only to rerun Varnish.
Error or tagless requests should not be cached.

@Fifciu Fifciu requested review from andrzejewsky and pkarw February 9, 2020 15:07
Copy link
Contributor

@andrzejewsky andrzejewsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good feature, but it can't be enabled by default. Please try to do something to make varnish as an addon

@Fifciu
Copy link
Contributor Author

Fifciu commented Feb 15, 2020

I've rebased it to the new develop. Removed network stuff from docker composes and put configured ones in docker/varnish/docker-compose. Varnish will only work if config.varnish.enabled equals true

@Fifciu Fifciu requested a review from andrzejewsky February 15, 2020 18:59
@Fifciu Fifciu changed the base branch from master to develop February 15, 2020 19:00
@andrzejewsky andrzejewsky merged commit 558a241 into vuestorefront:develop Feb 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants