All Projects → discord → Manifold

discord / Manifold

Licence: mit
Fast batch message passing between nodes for Erlang/Elixir.

Programming Languages

elixir
2628 projects
erlang
1774 projects

Projects that are alternatives of or similar to Manifold

Splay Tree
Fast splay-tree data structure
Stars: ✭ 80 (-93.81%)
Mutual labels:  performance
D2dlib
A .NET library for hardware-accelerated, high performance, immediate mode rendering via Direct2D.
Stars: ✭ 84 (-93.5%)
Mutual labels:  performance
Perf Hoc
(Deprecated) Visualize and detect unnecessary rendering and performance issues in React.
Stars: ✭ 87 (-93.27%)
Mutual labels:  performance
Lighthouse Keeper
Keep an eye on Google Lighthouse score changes directly on GitHub 💡👀
Stars: ✭ 82 (-93.66%)
Mutual labels:  performance
Quicklink
⚡️Faster subsequent page-loads by prefetching in-viewport links during idle time
Stars: ✭ 9,176 (+609.67%)
Mutual labels:  performance
Imtools
Fast and memory-efficient immutable collections and helper data structures
Stars: ✭ 85 (-93.43%)
Mutual labels:  performance
Jekyll Cloudinary
Jekyll plugin adding a Liquid tag for Cloudinary, for better responsive images
Stars: ✭ 79 (-93.89%)
Mutual labels:  performance
Karma Benchmark
A Karma plugin to run Benchmark.js over multiple browsers with CI compatible output.
Stars: ✭ 88 (-93.19%)
Mutual labels:  performance
Lighthouse Batch
Run Lighthouse analysis over multiple sites in a single command
Stars: ✭ 83 (-93.58%)
Mutual labels:  performance
Streaming Benchmarks
Benchmarks to compare Haskell streaming library performance
Stars: ✭ 87 (-93.27%)
Mutual labels:  performance
Pwmetrics
Progressive web metrics at your fingertipz
Stars: ✭ 1,243 (-3.87%)
Mutual labels:  performance
Lightkeeper
Run Lighthouse tests in Pull Requests for multiple URLs with custom budgets
Stars: ✭ 83 (-93.58%)
Mutual labels:  performance
Doom Nano
A 3d raycast engine for Arduino
Stars: ✭ 86 (-93.35%)
Mutual labels:  performance
Phpbench
PHP Benchmarking framework
Stars: ✭ 1,235 (-4.49%)
Mutual labels:  performance
So 5 5
SObjectizer: it's all about in-process message dispatching!
Stars: ✭ 87 (-93.27%)
Mutual labels:  message-passing
Json in type
Fast json encoder in rust, that encodes the structure of JSON values in their types
Stars: ✭ 80 (-93.81%)
Mutual labels:  performance
Methodtraceman
用于快速找到高耗时方法,定位解决Android App卡顿问题。通过gradle plugin+ASM实现可配置范围的方法插桩来统计所有方法的耗时,并提供友好的界面展示,支持耗时筛选、线程筛选、方法名筛选等。(A Tool for Discovering High Time-consuming Methods for Android App)
Stars: ✭ 1,258 (-2.71%)
Mutual labels:  performance
Xpedite
A non-sampling profiler purpose built to measure and optimize performance of ultra low latency/real time systems
Stars: ✭ 89 (-93.12%)
Mutual labels:  performance
Hibernate Performance
Samples for "Hibernate performance tuning" talk
Stars: ✭ 87 (-93.27%)
Mutual labels:  performance
Junitperf
⛵️Junit performance rely on junit5 and jdk8+.(java 性能测试框架)
Stars: ✭ 86 (-93.35%)
Mutual labels:  performance

Manifold

Master Hex.pm Version

Erlang and Elixir make it very easy to send messages between processes even across the network, but there are a few pitfalls.

  • Sending a message to many PIDs across the network also copies the message across the network that many times.
  • Send calls cost about 70 µs/op so doing them in a loop eventually gets too expensive.

Discord runs a single GenServer per Discord server and some of these have over 30,000 PIDs connected to them from many different Erlang nodes. Increasingly we noticed some of them getting behind on processing their message queues and the culprit was the cost of 70 µs per send/2 call multiplied by connected sessions. How could we solve this?

Inspired by a blog post about boosting performance of message passing between nodes, Manifold was born. Manifold distributes the work of sending messages to the remote nodes of the PIDs, which guarantees that the sending processes at most only calls send/2 equal to the number of involved remote nodes. Manifold does this by first grouping PIDs by their remote node and then sending to Manifold.Partitioner on each of those nodes. The partitioner then consistently hashes the PIDs using :erlang.phash2/2, groups them by number of cores, sends to child workers, and finally those workers send to the actual PIDs. This ensures the partitioner does not get overloaded and still provides the linearizability guaranteed by send/2.

The results were great! We observed packets/sec drop by half immediately after deploying. The Discord servers in question also were finally able to keep up with their message queues.

Packets Out Reduction

Usage

Add it to mix.exs

defp deps do
  [{:manifold, "~> 1.0"}]
end

Then just use it like the normal send/2 except it can also take a list of PIDs.

Manifold.send(self(), :hello)
Manifold.send([self(), self()], :hello)

Configuration

Manifold takes a single configuration option, which sets the module it dispatches to actually call send. The default is GenServer. To set this variable, add the following to your config.exs:

config :manifold, gen_module: MyGenModule

In the above instance, MyGenModule must define a cast/2 function that matches the types of GenServer.cast.

License

Manifold is released under the MIT License. Check LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].