Skip to content

Commit

Permalink
Merge pull request #205 from omisego/temp/perftest-how-to-run-improved
Browse files Browse the repository at this point in the history
Temp/perftest how to run improved
  • Loading branch information
pnowosie committed Oct 11, 2018
2 parents 02be8ed + 0c5337b commit 681b162
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ config :omg_db,

```
rm -rf ~/.omg/data_watcher
mix do ecto.drop, ecto.create, ecto.migrate, run --no-start -e 'OMG.DB.init()' --config ~/config_watcher.exs
mix do ecto.reset, run --no-start -e 'OMG.DB.init()' --config ~/config_watcher.exs
```

#### Start the Watcher
Expand Down
10 changes: 7 additions & 3 deletions apps/omg_performance/lib/performance.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ defmodule OMG.Performance do
@moduledoc """
OMG network child chain server performance test entrypoint. Setup and runs performance tests.
# Examples
# Usage
Always `cd apps/omg_performance` before running performance tests
## start_simple_perftest runs test with 5 transactions for each 3 senders and default options.
```> mix run --no-start -e 'OMG.Performance.start_simple_perftest(5, 3)'```
```> mix run -e 'OMG.Performance.start_simple_perftest(5, 3)'```
## start_extended_perftest runs test with 100 transactions for one specified account and default options.
```> mix run --no-start -e 'OMG.Performance.start_extended_perftest(100, [%{ addr: <<192, 206, 18, ...>>, priv: <<246, 22, 164, ...>>}], "0xbc5f ...")'```
## extended test is run on testnet make sure you followed instruction in `README.md` and both `geth` and `omg_api` are running
```> mix run -e 'OMG.Performance.start_extended_perftest(100, [%{ addr: <<192, 206, 18, ...>>, priv: <<246, 22, 164, ...>>}], "0xbc5f ...")'```
## Parameters passed are: 1. number of transaction each sender will send, 2. list of senders (see: TestHelper.generate_entity()) and 3. `contract` address
# Note:
Expand Down
6 changes: 3 additions & 3 deletions apps/omg_performance/lib/sender_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defmodule OMG.Performance.SenderManager do
Any unexpected child reportind :EXIT should result in a crash
"""
def handle_info({:EXIT, from_pid, _reason}, %{senders: [{_last_seqnum, from_pid} = last_sender]} = state) do
_ = Logger.info(fn -> "[SM]: Senders are all done, last sender: #{inspect(last_sender)}. Stopping manager" end)
_ = Logger.info(fn -> "Senders are all done, last sender: #{inspect(last_sender)}. Stopping manager" end)
write_stats(state)
{:stop, :normal, state}
end
Expand All @@ -98,14 +98,14 @@ defmodule OMG.Performance.SenderManager do

{_done_seqnum, done_pid} = done_sender ->
remaining_senders = Enum.filter(senders, fn {_seqnum, pid} -> pid != done_pid end)
_ = Logger.info(fn -> "[SM]: Sender #{inspect(done_sender)} done. Manager continues..." end)
_ = Logger.info(fn -> "Sender #{inspect(done_sender)} done. Manager continues..." end)
{:noreply, %{state | senders: remaining_senders}}
end
end

def handle_info({:EXIT, _from, reason}, state) do
write_stats(state)
_ = Logger.info(fn -> "[SM] +++ Manager Exiting (reason: #{inspect(reason)})... +++" end)
_ = Logger.info(fn -> " +++ Manager Exiting (reason: #{inspect(reason)})... +++" end)
{:stop, reason, state}
end

Expand Down

0 comments on commit 681b162

Please sign in to comment.