I am a newbie to Elixir and have a question about a small application that processes messages from two websocket servers. It holds state in a key-value bucket and sends messages out to the servers periodically.
There are five modules:
- A key-value bucket Agent
- One websockex client with some processing of messages, storing results in (1)
- Another websockex client with very little processing, also storing results in (1)
- A diagnostic module that prints to the console occasionally, pulling state from (1). It mostly sleeps.
- A continuously looping module/function that pulls state from (1), writes to (1) and sends some websocket messages out.
As expected (1) and (5) are very busy. The application runs on a four logical core system but consistently uses only 25 percent of total CPU available spread across two cores/schedulers. Also, the CPU usage is strictly out of phase with each other.
As the calls to the key-value Agent are synchronous I am not surprised if that it is a bottleneck, but I don’t understand why the application maxes out at precisely 25 percent of total CPU (i.e. one core’s worth) that is distributed across two cores in an exactly out of phase manner. Shouldn’t (5) run much hotter on average than (1)?
Or am I not reading the relevant info from observer correctly? Are there other things I should be looking at? Any help most appreciated.