storing huge amount of image on server

I'm developing web application like Instagram I need to save my downloaded images on the server how I can do that?

*. there are a lot of images (about 500k) so I can't save them on the server's directory. *. high availability and speed of serving images is really important for me.

what's best recommended tool to get the job done.