jamulussoftware / jamulus

Jamulus enables musicians to perform real-time jam sessions over the internet.
https://jamulus.io
Other
1k stars 224 forks source link

Algorithm for selecting best server for jam #575

Closed timo12357 closed 4 years ago

timo12357 commented 4 years ago

Our Jamulus band is spread all around western and eastern Europe and we struggle finding a good server, that would provide decent latency for all.

This problem should be possible to be solved by Jamulus with an algorithm based on just a few criteria:

  1. The servers under consideration SHOULD be empty
  2. The latency for any player in the band MUST NOT exceed 40 ms
  3. The drummer SHALL have the lowest latency
  4. Of the servers fulfilling the above requirements the one with the lowest sum of latencies OR lowest average latency for the whole band SHALL be selected and proposed to the user.

The implementation could be a button that once pressed runs an algorithm fulfilling the above requirements and then proposes a list of servers in order of quality for the players in the current server. If no server that fullfills the requirements can be found, the algorithm should indicate that to the user and exit.

The benefit of this would that more music would be played and less time would be spent on non music related tweaking.

pljones commented 4 years ago

No client can work this out on its own - it would need co-operative, peer-to-peer exchange of information. But how do the clients know about each other if they're not on a server?

timo12357 commented 4 years ago

These are implementation issues. The algorithm needs to know who is in the band. One way is to assume all clients connected to the current server form a band. The algorithm should probably run on the client and request the other band member clients for a listing of server latencies.

pljones commented 4 years ago

It would have to run on each client -- only that client can know its latencies to a list of servers.

First, each client finds the server with the minimum ping.

The clients exchange this information and take the worst ping, plus 5ms, cut off at 40ms (or some other value).

Each client then determines the set of servers within this ping range and exchanges that list with the others. Any client may say "no, that one's worse than the threshold for me" and such a server is eliminated. A common set is thus established.

From that set, you find the empty servers and the drummer gets to say "it's this one, then".

gilgongo commented 4 years ago

Something like this? Assuming in most cases there wouldn't be more than about three suggestions (and that server names aren't that important, so maybe a tooltip for that if people were curious before they connected).

(This reminds me that the UI is gradually getting to the point where it's going to need a refactor. But that's another story)

suggest-servers

timo12357 commented 4 years ago

Nice, that would do. I agree max three suggestions should be quite enough

timo12357 commented 4 years ago

How does one label this as a feature request?

pljones commented 4 years ago

@gilgongo That hasn't connected you to the other clients in the set, so it cannot work that simply.

As I said originally, without knowing who the others are, this cannot work.

timo12357 commented 4 years ago

@pljones I think the UI mock up looks good and should be sufficiently simple for any user to understand and use it. The actual functional implementation still needs ideas how to do it. What would your proposal on how to implement it be?

pljones commented 4 years ago

The UI mock up fails to enable the functionality, therefore is useless in providing anything at all to the user. "Simple" it may be. But it doesn't meet the needs here.

You need to decide on how the communication between players is established. This hasn't been answered. That is NOT part of the implementation, it's part of the specification. Which users will be polled? Every single one that any central server anywhere in the universe has ever seen..? No, don't be ridiculous. But WHICH, then? HOW do you decide??

gilgongo commented 4 years ago

Oh I see (glad I did the mockup then!)

I was assuming the system would take all the people currently on the server (two in the mockup) at the time the button was pressed, and show them the suggestions as shown. Note that I show the button greying out until you either dismiss or join one of them (so people can't hit it too often maybe). I suppose in the case of multiple suggestions you'd need to use the chat or something to decide which to go for though.

In my defense, the mock-up wasn't very considered. Could do with some more thought 🙂

pljones commented 4 years ago

No one in Jamulus should have "power over" anyone else in Jamulus. It needs to be elective by consent. Just because you and another user are on the same server, does not mean that user has elected to be involved in this poll activity that's being discussed here.

So a completely new way of having users interact - outside the existing server mechanism is required.

It's really back to my comment on another ticket - use Facebook Messenger, Jitsi or something to organise it. It's not something you implement inside Jamulus.

corrados commented 4 years ago

I use Jamulus about 15 years now, where I rehearse for about 10 years with my online band. My experience is that the ping time is not the only criteria for selecting a server. There are others like:

If you have a band which will practice, e.g., weekly, you will most probably once search for a suitable server and then use that all time. That is how we do it with my online band.

If it is just a jam session with strangers, you will not get the others to leave a server where a session is going on. Either the server is ok for you or you have to live with the delay or just do not attend that jam session.

So in my opinion it does not make sense to implement such a "server recommendation" feature.

gilgongo commented 4 years ago

@timo12357 I suppose there's nothing stopping somebody else creating a separate app that would do what you suggest. The addresses of all public servers and those connected to them are available publicly, which may be enough to start with. But I'm not qualified to know.

In fact I'm sure I saw somebody on the forums said they had set up a project (they had a Facebook group) to help people find people to play with - this might be related.

timo12357 commented 4 years ago

As the project owner does not see the idea worth implementing I will close the feature request as redundant.

corrados commented 4 years ago

Well, it was not my intention to force you to close this Issue. It is always good to discuss feature requests. Obviously, you and your bandmates have a problem and you search for a solution. But as pljones has already written, it is not as easy as adding a simple button on the main Jamulus window. You would have to specify which are your bandmates. Then you have to specify which server list you want to use (maybe all)? So the ping times of all bandmates plus all lists would have to be collected at a central place and then a smart algorithm has to select the appropriate server. This is a huge coding effort. And this is the reason I wrote my concerns in my post above.

But still, the problem is there and maybe there is another solution to your problem, yet to be found...