Answer the question
In order to leave comments, you need to log in
Storage of avatars in the database, what do you say?
Hello!
There was an idea to store user avatars not as files, but in the database, in base64. I want to reduce the number of requests to the server in this way, and the total number of files (since the hosting has a limit on the number of files). And in principle, fooling around with architecture is not a hunt. At the same time, avatars have a size of about 10-20 kb in size (in base64). So from interestingly, what are the pitfalls with this approach ?? Will the load on the base increase significantly, and is it worth it? And the second question, if you store avki in the database, then in a separate table, or you can immediately add a column to the table with users.
Thank you in advance!
Answer the question
In order to leave comments, you need to log in
I want to reduce the number of requests to the server in this way
Never do that. Files need to be stored in the file system, it copes with this better, as it is designed for this. The files are not stored in the database. Add the path to the file to the base, but not the file itself. It will be much more efficient.
1) Overhead when stored in the database64 about 30%. that is, + 30% to traffic, and given item 2 - even more.
2) Browser cache doesn't work with base64 images (and works great with images in files).
3) Store files in files.
4) Click on the number of files and place - gravatar.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question