php - Performance: Lots of Images vs Lots of Directories in a web server -


so developing website company , may have, approx 1,000-5,000 profiles (of vendors , users), have store approx 10 images per vendor on directory on website's server (which retrieved using php), wondering better performing way it. have 2 choices:

  1. having images profiles in single folder (single folder having 10,000 images)

  2. having separate directories profiles having 10 images each (1,000 folders having 10 images each.)

so way should performance of website, on server running linux, better? know @ scale, may not matter concern, may expand, have more profiles , server using slow (you can see impact in performance after include php file).

i'll using like:

<?php     ($i = 1; file_exists("img/vendors/vendor_id_".$i.".jpg"); $i++)     {        echo "<img src=\"img/vendors/vendor_id_".$i.".jpg\">";     }  ?> 

or

<?php     ($i = 1; file_exists("img/vendors/vendor_id/".$i.".jpg"); $i++)     {        echo "<img src=\"img/vendors/vendor_id/".$i.".jpg\">";     } ?> 

thanks.

it better store them in separate folders, believe premature optimization. recommend putting them single folder sake of simplicity , if later have performance issues, can migrate folders. now, handling folders make slower performance gain separation.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -