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

Tricks to make it faster? #860

Open
mikealche opened this issue May 21, 2024 · 3 comments
Open

Tricks to make it faster? #860

mikealche opened this issue May 21, 2024 · 3 comments
Labels

Comments

@mikealche
Copy link

Hey there!
What a fun project!! I'm having loads of fun using it.

I want to render a page where there are many memes (well 12 really) , and this seems to almost take down the deployment (the cheapest Heroku Dyno).

What tricks can I use to make it lighter on the server?
Specifying smaller dimensions?
Upgrading the Heroku Dyno?
Thanks!

@jacebrowning
Copy link
Owner

jacebrowning commented May 22, 2024

https://api.memegen.link is running as a single basic Dyno and handling about 2k requests per hour.

For the provided Procfile, the following environment variables are set:

MAX_REQUESTS=400
MAX_REQUESTS_JITTER=50

It's also running behind Cloudflare to cache images, but that shouldn't impact server performance for new images.

@mikealche
Copy link
Author

Thanks for the tip! yesterday I've added those env vars.
However, Heroku keeps restarting bc of memory quota exceeded. (each red box in the above graph is a critical event that shuts down the Dyno)

image

Could there may be a memory leak somewhere?

@jacebrowning
Copy link
Owner

jacebrowning commented May 23, 2024

It's possible there could be a memory leak, though I suspect that would be in the image generation library (Pillow). Any investigation into that would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants