petelacey

petelacey

The Phoenix/LiveView-based product that my company makes has a very unusual usage profile. For months at a time, any particular customer will make very light usage of it. Until, suddenly, 20, 50, or even 100 or more users will start pounding on the product at once. This will last for 1-3 weeks before going silent again. This is expected and not a big deal.

However, the industry we serve is such that when these, say, 50+ people are hammering away, they are physically together in the same room as they do so! Furthermore, our customers are not tech savvy and so they tend to all be connected to the same under-powered office WiFi access point.

If this was a normal web application, then that wouldn’t be a problem. But with LiveView I now have 50+ people sitting inches away from each other and trying to keep a persistent websocket connection in place, all while uploading/downloading gigabytes of data per day. The result is calls to our support line saying the product is slow, when in reality they have an oversaturated access point and probably a great deal of EM interference.

What I’d like to do in this situation is simply notify users that their connection is wobbly and provide a link to instructions on how they can mitigate this. I experimented with JavaScript’s navigator.connection property (Chrome only, but that’s okay) and that might be enough. But it didn’t seem to notice when I enabled the liveview socket’s enableLatencySim, and I’m not sure if it should have.

In any event, I’m wondering if anyone else has dealt with this and what solutions you have come up with?

Thanks, Pete

Showing Posts 1 to 8

arcanemachine

arcanemachine

This is a pretty hacky idea, but perhaps you could use Phoenix Presence to detect when a lot of users from the same organization or IP address are present at the same time, and just pre-emptively send a warning when a certain simultaneous user count is reached.

Obviously not the most practical idea, but if nothing comes up, it may be a workable (and easy-to-implement) solution.

olivermt

olivermt

If you have links to mitigate this, why not just… pre-mitigate? Or are these groupings dynamic in nature?

cheerfulstoic

cheerfulstoic

I’m not familiar with navigator.connection, but you could perhaps use Chrome’s throttling it it’s DevTools for something which is probably lower-level than what Phoenix/LiveView can simulate:

Also, have you done any optimization of your LiveView? Sometimes it does some annoyingly inefficient things when sending data over the wire. This presentation has some tips on how to help with that:

Also, they’ve been introducing some optimizations in newer versions of LiveView which take care of optimization in some cases with you having to do anything, so upgrading might help.

petelacey

petelacey OP

Unfortunately, the “mitigation” entails telling people to call IT and have them bring in some switches and ethernet cables. And, yeah, the groupings are dynamic and not known in advance.

petelacey

petelacey OP

There’s plenty of room for us to optimize LiveView, but I’m certain the problem would still exist. It’s really a matter of too many people transferring too much data over too many connections on a single AP. Exacerbated by many of those connections (though not the file upload/download ones) being persistent LiveView sockets.

krasenyp

krasenyp

I’d say it’s not the job of the server to notify the user if their connection is slow. It’s the job of the client. You should somehow observe the network requests and determine if they’re slow enough to notify the user.

Unfortunately, with LiveView running on a websocket, I don’t have any ideas how to do the above.

rhcarvalho

rhcarvalho

Not a definitive answer, but:

  • Some tips here: Simulate Latency, Jitter, and Package Loss in Phoenix LiveView
  • I also recall a talk in which Chris McCord demos a LiveView showing live latency to clients around the world, but I couldn’t find it now.
  • Probably the best integration points would be global code in app.js monitoring client network performance, or a client Hook. In the absence of a better idea, you can measure pings between client and server and use that to trigger adding a CSS class/JS command to show the message about contacting IT, etc.
namxam

namxam

Honestly, this sounds like a pretty feasible solution. It is rather easy to implement and you could simply configure the amount of connections before an info message appears, notifying the end user, that there are many connections from a single IP.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews