如何描述我的elixir phoenix服务器?

时间:2018-03-07 10:43:09

标签: elixir phoenix-framework

我有一个Phoenix服务器,它基本上将GraphQL代理到很多REST API后端。它从提供的JWT中找到用户名,并选择适当的后端。

现在,我对后端进行了基准测试,以便能够处理13K req / sec。 但我的GraphQL前端只能执行400 req / sec,而在dev模式下只需要15 req / sec ..

我怀疑JWT处理是问题所在,但我如何确认?

我试过:观察者,但这个输出让我感到困惑('减少'?)

observer output

编辑:我被指向了erlang tracer和fprof。所以我决定试试fprof。找到this blog post。这是我的控制台输出,现在我又被卡住了:

iex(wobble@localhost)1> :fprof.trace([start, {procs, [whereis(my_web) ]}])
** (CompileError) iex:1: undefined function start/0

iex(wobble@localhost)1> :fprof.trace([:start, {procs, [whereis(my_web) ]}])
** (CompileError) iex:1: undefined function procs/0
    (stdlib) lists.erl:1354: :lists.mapfoldl/3

iex(wobble@localhost)1> :fprof.trace([:start, {:procs, [whereis(my_web) ]}])
** (CompileError) iex:1: undefined function whereis/1
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (stdlib) lists.erl:1355: :lists.mapfoldl/3

iex(wobble@localhost)1> :fprof.trace([:start, {:procs, [:whereis(my_web) ]}])
** (SyntaxError) iex:1: syntax error before: '('

1 个答案:

答案 0 :(得分:1)

Reductions是Erlang中执行的单位。您可以将其视为机器代码中的指令。

您要做的是运行tracer。它会告诉你你的函数被调用的次数。