Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varnish for APIP 2.6 #1947

Open
Chris53897 opened this issue Jun 21, 2021 · 4 comments · May be fixed by #2487
Open

Varnish for APIP 2.6 #1947

Chris53897 opened this issue Jun 21, 2021 · 4 comments · May be fixed by #2487

Comments

@Chris53897
Copy link
Contributor

With APIP 2.6 there is no more varnish in the new docker setup.
I have response times from 50-100 ms for most endpoints. Endpoints are secured with JWT.
Without varnish APIP or some other caching i assume there is a lot of trouble with medium or high traffic.
This article looks good to solve problems with varnish.
https://jolicode.com/blog/scaling-the-symfony-demo-app-to-the-extreme-with-varnish

Did someone get caddy to work with varnish for APIP 2.6?

@dunglas
Copy link
Member

dunglas commented Jun 21, 2021

Adding Varnish should be straightforward but AFAIK there is no existing docs about this yet.

Alternatively, you could use Souin or the Caddy cache-handle, which should switch to Souin soon.

@Chris53897
Copy link
Contributor Author

Thanks for the info.

A Cache-Plugin for Caddy will be great with APIP-Support. There is a lot of good ideas on the Todo-List. I am looking forward to it. But it looks that it is not production ready yet. Is there any documentation to use it with APIP 2.6?
Cache-Handler
Souin

I made a proof of concept, but there is still a lot of work.
#1961

@darkweak
Copy link

darkweak commented Jul 9, 2021

Hi @Chris53897 the cache-handler and Souin are available as Caddy module you just have to add either --with github.com/caddy/cache-handler or --with github.com/darkweak/souin/plugins/caddy in the api/Dockerfile and base your Caddyfile declaration (located inside the api/docker/caddy/Caddyfile) according to the selected repository.
Souin Caddy sample configurations
cache-handler

@polarathene
Copy link

polarathene commented Aug 18, 2021

Souin is in a better state at present for handling Cache than cache-handler (which will eventually be equivalent to the Souin caddy plugin AFAIK).

Presently Souin has some quirks to resolve with building the Caddy plugin module via xcaddy. It does seem promising and I plan to try it out soon myself (unrelated to api-platform).

I am still in an evaluation stage myself, but from what I've read of Varnish through their docs, they seem to have a rather decent solution, while Souin as a Caddy module (when ready) looks to be competitive and offer a better UX.

Souin docs and examples need improvement at present, and I may contribute to that if I adopt it for production use, in the meantime I would advise Varnish if you have advanced requirements (more established ecosystem, community/resources, detailed docs, examples, resulting in less friction).

rbayet added a commit to Elastic-Suite/gally that referenced this issue Feb 13, 2022
Includes now defunct API Platform Varnish configuration.
From https://github.com/api-platform/api-platform/blob/v2.5.7/api/docker/varnish/conf/default.vcl

Please note that is a BAN based purge (which is kinda meh ?)
Please see also
FriendsOfSymfony/FOSHttpCache#495
api-platform/core#1856
api-platform/api-platform#1947
rbayet added a commit to Elastic-Suite/gally that referenced this issue Feb 14, 2022
Includes now defunct API Platform Varnish configuration.
From https://github.com/api-platform/api-platform/blob/v2.5.7/api/docker/varnish/conf/default.vcl

Please note that is a BAN based purge (which is kinda meh ?)
Please see also
FriendsOfSymfony/FOSHttpCache#495
api-platform/core#1856
api-platform/api-platform#1947
PierreGauthier pushed a commit to Elastic-Suite/gally that referenced this issue Jan 12, 2023
Includes now defunct API Platform Varnish configuration.
From https://github.com/api-platform/api-platform/blob/v2.5.7/api/docker/varnish/conf/default.vcl

Please note that is a BAN based purge (which is kinda meh ?)
Please see also
FriendsOfSymfony/FOSHttpCache#495
api-platform/core#1856
api-platform/api-platform#1947
@darkweak darkweak linked a pull request Jul 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants