joshnissenbaum
Hey guys. I’m pretty new to Elixir and Phoenix after swapping from NodeJS & MongoDB. Some of my requests are taking 1-2 seconds on the first attempt. Each request thereafter is about 300-400ms. How do I increase the speed of these responses? The smaller responses range from 40-60ms to 100-150ms on my local machine on the first request. The server is located in the US and I’m in Australia. (This adds about 300ms automatically)
Do these numbers sound normal? What steps can I take to increase these speeds?
- I’ve tried increasing the Ecto pool size to 20
- I’m running a Heroku Hobby plan
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
gen1321
Well, they kinda sound normal to me but it’s hard to judge without codebase. The only thing thing that is really strange is increased first attempt speed and i have no clue what could case that. Anyway the first thing that i would look is the database. check indexes and n+1 stuff.
nsweeting
The reason for the slower response on the first hit is that you are most likely running your application via mix, which will lazy load code. If you were running a release, the code would be eagerly loaded, and you would most likely not notice such a large initial slowdown.
As for other slow responses - without knowing the details of the query being made, we won’t be much help. Is it using indexes? 50-100ms isn’t too bad though. If you’re still not happy, perhaps consider using a service to profile the request. That would provide greater insight into what is going on.
sfusato
I was experiencing the same on test deploys to Heroku, but that was because I was using the free plan, where the dyno will sleep after 30 minutes of inactivity.
https://devcenter.heroku.com/articles/free-dyno-hours#dyno-sleeping
jdumont
When I was first experimenting with Elixir I used Herokus free hosting tier and experienced exactly the behaviour OP is describing. However he’s on the Hobby plan (which doesn’t sleep) that I later used and found to be very quick, with no delays on the first request.
I’m not 100% on the minutiae of Elixir on Heroku — I don’t think it’s a full blown release a la Distillery, but it also seems faster than straight
mix. Again, when I used to run on their Hobby plan I found it to be very fast from the off. I used the build packs which AFAIK is the only way to deploy to Heroku?It sounds like something else is going on here. Running on Heroku it’s unfortunately harder to debug and see what’s going on using things like the observer. The only thing that does stand out was your use of a
POOL_SIZE=20. The docs suggest less than the max to allow for running admin tasks.Have you tried using standard web speed tools like Pingdom? Whilst not specific to your app’s architecture, it might give you an idea if you’re just suffering from DNS issues. The fact that the first load is slow but future ones are fast could be due to DNS…
Qqwy
We recently have had the same thing on a Ruby on Rails-repository. We moved to Heroku for ease of installation, but ended up moving away because of:
www.*to your normal application because Heroku requires you to point your DNS at a dynamic IP which DNS does not natively support.Because that was a Rails-application (using Sqlite as DB), I’m not sure if Elixir/Ecto pool sizes are the bottleneck here, but I’d love to hear your thoughts, because we also were unable to find out what caused this issue.
OvermindDL1
I’ve been using some $3 OVH VM’s to host some elixir stuff recently and I’m surprised how well it runs, only 2 gigs ram and a single core but it’s worked really well and it’s easy enough to upgrade if I need, plus it’s a full root OS install so you can do whatever you want.
dimitarvp
Isn’t 1-core crippling for Elixir though?
OvermindDL1
Not really, all IO is async, and these aren’t loaded down by any stretch (IRC/Discord bots, git webhooks, static website rebuilder, etc… and these all run on the same $3 VM). Anything big will run on my big servers.