Dustin McCraw
3/10/20
for IOS and Android.
It makes a bunch of calls in parallel to Snapi so that mobile doesn't have to. Allows changes to the cards without needing to update mobile clients.
Hoyle is written in Elixir and Phoenix.
Elixir is a dynamic, functional language designed for building scalable and maintainable applications.
Uses Phoenix web framework.
https://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections
60-80 pods/containers?!?!?!?!?!?!?
How can this be possible with Elixir?
Kube takes care of scaling for us.
We just have to find the correct settings.
So I had to figure out what was causing it to scale to 80 pods.
I found code that was setting ETS but never deleting it.
Fixed that and now Kube wasn't bringing down
pods because of memory.
But we were still running 35 pods
Elixir has it's own built in memory cache called ETS (Erlang Term Storage) so no need to bring in redis or memcache.
But we were still running 35 pods
Looking over DataDog I saw 35 pods but with less than 1% CPU, basically, idling?
That's when I learned about Kube resources.
You can configure what Kube uses when creating a new pod and for determining when a pod is using too many resources.
The settings on the left make sense for a Ruby app since it can't take advantage of multiple cores.
But Elixir can use all of a machines cpu's.
We had to limit our resources to 7 CPUs since our
Kube cluster only has 8 CPUs.
By examining what was being called there was more caching we can do.
18% decrease response time
We auto-scale between 1 and 7 pods
depending on traffic down from 60-80.
P.S. The one on the bottom is our staging server.
At the peak, with 7 pods running:
Almost 1/3 of all traffic to Snapi comes from Hoyle on only 7 pods.
Use the smaller json format Snapi supports, or gzip or http2
application/prs.snapi+json
What if we made our clusters larger? 12-16 CPU's?
What if we have longer TTL's? specific endpoint caching?
What's our cache hit rate?
How many times a specific card is displayed?