V
V
Vitaly Kiyashko2019-06-13 11:01:44
Nginx
Vitaly Kiyashko, 2019-06-13 11:01:44

How to cache many small files to disk?

Situation. There is a service for watching videos. Traffic somewhere around 6 Gbps. Content - files up to 4 mb in size.
There are 5 intermediate servers that pass traffic from the main storage through themselves. Traffic is about 1.5 Gbps. On intermediate servers there are ssds in raid 0, the capacity is about 1.7 TB on each.
The task is to cache part of the content.
Problem. With simultaneous writing to the cache and reading from the cache, the brakes begin when watching video from this intermediate server.
Question. How to organize a cache on disks so that there are no brakes? It is noticed that the brakes appear only when writing and reading from the disk at the same time. If you only write to disk or only read from disk, there are no brakes when viewing.
How to solve this problem?
There are no brakes either if you use varnish with a cache in ram. But that's not an option. You need a cache on the disks.
What else could be the solution?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Olohtonov, 2019-06-14
@sgjurano

And how high is iowait on your machines?
In general, responding from the disk is not a very good idea, it would be best to keep the second level of caching in memory, then you can respond to a significant part of the requests without touching the disk subsystem at all.
For reference:
SSD latency ~ 1 ms
RAM latency ~ 100 ns
SSD throughout ~ 1Gb/sec
RAM throughout ~ 10Gb/sec

V
Vitaly Kiyashko, 2019-06-14
@ZIM555

Thanks for the info. Lacquer is currently running with cache in ram. But even with 20gb of cache on 5 servers, it gives a traffic gain of about 20 Mbps from each server at best. Nginx on files gave out up to 120 Mbps.
The question is how to organize it so that part of the cache is in memory and part is on disk?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question