Wordpress - Could a large quantity of files in the uploads folder affect performance?

Short Answer: No

A different question is: Will uploading a large number of files in WordPress affect performance? The answer to this: Most likely not.

Reason:

  • WordPress uses the DB to get a list of uploaded files (almost no difference for many files)
  • FTP uses the filesystem (slower for many files)

Details:

WordPress does not list the directory contents of the uploads folder, so you can dump any amount of files there without WordPress even noticing it.

When you upload a file via WordPress a new DB entry is made to your wp_posts table. WordPress only knows about the media files by looking into wp_posts, so uploading a ton of files will add more lines to that table and therefore makes SQL queries a bit slower. Though honestly the amount (20.000 entries in DB) will not have a big impact on most hosting environments. Also WordPress has optimizations at every end to make it run fast (e.g. it caches SQL results and limits the number of queried rows)

However, as you noticed: When accessing the folder via FTP it freezes. This is caused by FTP requesting a list of all files the folder, and the server takes a while to answer with a list of 20.000 filesnames. But this performance issue is not affecting WordPress itself.


Well, does it affect site performance? If you are not noticing in actual site operation then likely not, at least at your number of files.

There are performance considerations for large amounts of files. Budget hosts (which know what they are doing) typically even put in explicit limits on filesystem usage.

However in WordPress operation you are not hitting filesystem that much. The way attachments work is that paths to file (and its sizes in case of images) are stored in database. In that way there is rarely need to access (or worse - scan) filesystem just to know where the files is and point to it.

I hadn't encountered this directly, but to my knowledge the issues with large (like millions of files large) amounts of attachments in WordPress start to exhibit on database querying level before filesystem. But then I would guess people with millions of files would already have server/filesystem setup capable of handling it.