In your case, I highly recommend that you have a blob field in your database and store images in it. Mostly because it is the right place for them. So make a Servlet that retrieves the image of the specified user from the database. For example, /userimage?name=john .
About your size / performance issue:
Databases were made (among other things) to store and exchange large amounts of data .
So this is the best option .
Even if you store them on other sites, they will still reduce free space and performance.
If you really want to manage LARGE data (> = 3TB, not your case), you can save them in the file system and save the file names in the database. See this question for more information.
source share