mspanc

mspanc

Membrane Core Team

Synchronizing time between two processes NOT within cluster

Hello,

I am writing an app where I need to synchronize time between two processes, running on two nodes that are not within cluster (and they cannot, by design). I can’t use NTP daemon as I cannot assume anything about host OS configuration. So basically I need something like NTP-per-process or just generic NTP client/server implementation and I will wrap it. Any recommendations on how to do this properly erlang-way or about battle-proven ready-to-use libraries?

The problem I need to resolve is that basically both apps “tick” every 10ms, and send data to each other. There’s a certain time window for which the receiver waits for the data. I have found out that when using :timer.send_interval the timer skews and window moves and receiver starts dropping data as it is considering them arriving too late.

Most Liked

Qqwy

Qqwy

TypeCheck Core Team

What is the reason that you are using timers here? (especially using strict time windows).

Attempting to pretend like the laws of nature can be broken (here: that communication between two nodes can always happen instantly) will result in an hill-up battle when building algorithms.

If it is possible to use conflict-free replicated data types (CRDTs) for your application, I would definitely take a look at that instead.

Can you tell us more about your problem domain? There might be other approaches to circumvent the problems you’re having.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Yeah 100hz real time sync guarantees across a cloud network sounds like a problem I would want to avoid having.

Mandemus

Mandemus

You answered your own question in that you need to synch ticks not time. Similar to how RTS games such as Starcraft work under the hood, being turn based. Only, you won’t need the fixed point deterministic simulation part. :slight_smile:

You need to weight your timeout window in order to adjust for changing network latency. So you just need the delta between the last two ticks.

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
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
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
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
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
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

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
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
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement