shahryarjb

shahryarjb

High CPU consumption in my user micro service

Hello, I have a micro service that its job is manage my users, this micro service when is running and even without managing many user, or 0 user , it spends 20% cpu in developer mode, It is interesting to know, I have no error which makes me understand!! For this purpose I have no options to test my project.

How can I find this problem and fix this ?

erlang v: 20.3.1
elixir v: 1.6.4
phoenix v: 1.3.3
node v: 9.3.0
other container Redis v: 4.0.11
other container Postgresql v: 10.5

my lib in elixir project:

  defp deps do
    [
      {:postgrex, ">= 0.0.0"},
      {:ecto, "~> 2.1"},
      {:guardian, "~> 1.0"},
      {:jose, "~> 1.8"},
      {:httpoison, "~> 1.0"},
      {:plug, "~> 1.4"},
      {:comeonin, "~> 4.0"},
      {:bcrypt_elixir, "~> 1.0"},
      {:redix, "~> 0.7.0"},
      {:phoenix, "~> 1.3.0"},
      {:exq, "~> 0.10.1"},
      {:bamboo, "~> 1.1"},
      {:timex, "~> 3.4"},
      {:bamboo_smtp, "~> 1.6.0"}
    ]
  end

in phoenix project :

[
      {:phoenix, "~> 1.3.0"},
      {:phoenix_pubsub, "~> 1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:gettext, "~> 0.11"},
      {:trangell_users_service, in_umbrella: true},
      {:cowboy, "~> 1.0"},
      {:plug_cowboy, "~> 1.0"}
    ]

I am using Docker, and my project is Json base and doesn’t have Html render.

Most Liked

NobbZ

NobbZ

You are running :dev env on your server?


:etop and :observer are both part of the :observer application. If you have it installed on your system a simple :observer.start() or :etop.start() should be enough.

Just remote shell into your server and use them, that usually works. This means not SSH into server and then run iex, but to use iex --name ... --cookie ... --remsh server@node to connect.

OvermindDL1

OvermindDL1

For note, dev mode will use more power than prod mode because it actively recompiles and scans and all sorts of things like that.

Your etop listing is showing nothing is using cpu at that moment though.

NobbZ

NobbZ

You probably need to show some code.

Just by the dependencies you use its hard to tell.

Anyway, you should be able to use :observer or :etop to find out which processes use up your precious CPU.

NobbZ

NobbZ

For :observer you need to have wx-widgets installed. I never used it in a remote shell myself, but people told me it usually works. I can’t help you with that one.

Have you been able to figure something out using :etop?

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement