Hacker News new | ask | show | jobs
by quaunaut 3649 days ago
Very true, but what I particularly like is the raw speed- having a JSON API with an average response time in microseconds(ie, sub-millisecond) is super cool and goes a long way in transforming a web app into that native-app feel.

To be able to get that without sacrificing productivity is huge.

1 comments

How are you accomplishing that? Most databases take at least that long to get data back to your application.
Not necessarily. If the data is in the database's cache it can be pretty fast. I just tried `explain analyze select email from users where id = 10` on my local postgres, and while the first query took 20ms, the second one only took 0.065ms.
Not every API needs to hit a database for every call. This is especially true for Elixir/Phoenix because if you don't need your data to be persistent over a server failure, you can just store it in an OTP process/ETS table and keep it in memory.
It's also worth pointing out, the newest Ecto(released this week) has features that can do multiple database calls at once, since each one is put into its own connection pool and then assembled at the end. So even rather heavy calls get effectively zeroed-out.