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

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
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
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
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
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement