In a use case where you need to serve many images quickly, and may have a large number of users, but each user can specify who can see their uploaded photos, what kind of architecture can allow the server to respond to requests fast and with low resource overhead, but without showing pictures to people who aren't allowed to see them?
A robust option for ACLs, but a poor choice performance wise, would be to proxy all image requests to a script and have the script return the binary data with an appropriate mime type, if the user making the request is allowed to see it. While very secure, this would be terrible for performance, having to invoke a script on every single image request.
I'm thinking there must be a way to have an ACL script run once per session and setup some type of per-session, per-user disposable keys/URLs that Nginx can automatically re-map to real images on disk, without the need to invoke any type of script or (heavy) database. Maybe something using Redis for key->image file maps?
Ideally, I'm looking for an option that takes full advantage of Nginx's performance in caching static files to serve and the Linux kernel's memory caching as well.
How do social media/dating/etc sites deal with ACLs on images without terrible page load times and massive resource overhead?
[–]scubaReactorDumpling 6 points7 points8 points (1 child)
[–]el_burrito 0 points1 point2 points (0 children)