Slow assets phoenix in production & dev?

Im getting ready to launch my application and noticed that loading my assets are pretty slow in dev & production.
the page rendering and loading is fast, but some assets … :poop:

  • logo.png, 2kb, ~50ms
  • fontawesome-webfont.woff2?v=4.7.0, 60kb, ~500ms (ouch!)

I copied the font-awesome files to assets/static/fonts and checked Plug.Static

  plug Plug.Static,
    at: "/", from: :app_web, gzip: true,
    only: ~w(css fonts images js favicon.ico robots.txt)

im running an umbrella application and in production behind nginx rev proxy.

Have you ran mix phx.digest to pre-cache the files metadata before running mix release to make a production build (digests are not used in dev by default unless you changed options)?

I was away for a few days, sorry for my late reply.

Yes I did run mix phx.digest, that didn’t make any difference.
Now nginx is serving the assets, that solved the problem, but I still don’t know what was the problem … :slight_smile:

This is just a hypothesis, but woff is already compressed. Maybe gzipping it again is causing a slow down when decompressing?

1 Like

It would not ‘that’ much I’d think though. Plus when digested then it is pre-gzipped anyway.