thoughtarray

thoughtarray

Stress testing: doing something as quickly as possible at the "same time"

Hello, this is my first post, and I hope it isn’t already obviously answered in another post. I did my best to look.

Problem statement

I want to do something as quickly as possible at the “same time” (as possible). To simplify the realm of possibilities, let’s say I’m using :gen_tcp to send a packet.

What I do and don’t know

I know:

  • :gen_tcp is process-less and returns a Port
  • Some strategies for spawning large numbers of processes such as using PartitionSupervisor to spawn a DynamicSupervisor per CPU core

I don’t know:

  • How to handle ports (or what they are really in the context of a network socket)
    • Should I make one per CPU core, one per worker process, or something in-between?
    • Is NimblePool relevant here (can’t tell from the README)
    • Can I have multiple TCP connections/session per port?
  • How to signal to all workers to do something at the same time
    • How can I do this without causing a signal sender bottleneck? Can Phoenix PubSub cover this? Is there a simpler approach without building a bespoke pubsub myself?

Additional notes on what I want:

  • To make as many TCP socket connections as possible to more closely represent independent client connections

Context (not required reading)

I want to build a stress testing tool in Elixir that will be used against transports HTTP1.x and websockets. The point is to test the efficiency/throughput differences between the two approaches.

I know there’s a difference between the two transports in that the former is non-stateful and latter stateful, but I do want to be fair to HTTP1.x and use keep-alive; so maybe my request implementation can be similar-ish for a more apples-to-apples comparison.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New

Other popular topics Top

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
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49084 226
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
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement