Score:-1

What happens on the server when a multimedia file gets downloading/playing?

kr flag

I have a video-based website. It gets slow when about 1k concurrent users watch/download a video.

I'm trying to debug it to see what resource is weak to increase it. I executed htop command to see resource usage, but the server is over 50% free for both CPU and RAM when the page loading is too much slow (in that case, a simple webpage takes over 40sec to be loaded)

That's why I thought probably it's a bandwidth issue. Now all I'm trying to know is what happens when a video file is streaming/downloading by a client?

Note that, I have everything on the same server (backend/frontend/databases/video files)

cn flag
`all I'm trying to know is what happens when a video file is streaming/downloading by a client?` Every resource is throttled. If the limit that you contract for is exceeded, the usage of the resource will be throttled. These throttled apply to network throughput, network peak, storage IOPS, processor utilization, and anything else that a provider can think of to throttle.
Score:2
cn flag

Your logic is off.

If CPU and RAM are still good, there are TWO possible limiting issues.

  • Bandwidth
  • IO

And both are totally trivial to check from the server side. Do it.

Now all I'm trying to know is what happens when a video file is streaming/downloading by a client?

Depends what you mean by streaming, but essentially it grabs data from the source and forwards it to the target. Which is essentially a CPU non-issue not using a lot of CPU to start. Unless you have plenty of storage for caching (in RAM) configured and thus being used - data comes from the storage, whatever you have. Generally the area people are ignorant of and do not care - and often the bottleneck.

in that case, a simple webpage takes over 40sec to be loaded

Which would indicate you hit either a BRUTAL network limit, or a IO limit. And given how you prefer to not talk about IO at all, my bet is your IO is overloaded to comical levels. Unless you run SSD storage - often in a RAID configuration - your IO budget is comically low for a high bandwidth network - enough to saturate it with one stream, totally not enough by a large degree the moment your HDD heads have to move.

stack avatar
kr flag
I see, thanks for your answer, upvoted. Note that the server storage is SSD, but the videos are in high resolution. I want to know, when userA plays a video, the server puts that video on the RAM and sends the video, then the userA receives it. Ok, if userB also start playing that video, what happens? the server puts another instance of that video on the RAM and sends it for userB? I want to know how a server manages the bandwidth?
cn flag
This cannot be answered given your information - whether caching happens or not depends on configuration and software used, not on the hardware. Even the low RAM usage is too vague - are users watching the same video? How large would that be? Bottlenecks are either in processing or on the network - UPSTREAM from you if your network card is not overloaded, and that, again, we have no way to check from the computer.
vidarlo avatar
ar flag
Generally the kernel will cache data in free RAM. Thus, having plenty available RAM will speed up things. If something is cached in RAM by the kernel, any process who read that resource will get data from RAM. No sane delivery mechanism will read a file into RAM and serve from RAM; it will read and forward to the client.
cn flag
But he indicates that his RAM is under 50% use, which would mean that this does not happen. There can be multiple reasons for that - from configuration to everyone watching the same data and the problem being upstream network wise.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.