Support » Plugin: SI CAPTCHA Anti-Spam » [Plugin: SI CAPTCHA Anti-Spam] Performance issue, temp files contaminate php opcode cache

  • Hello,

    One of my clients is using this plugin and I’m noticing that it creates excessive amounts of tiny temporary files. After about a 6 hours, there will be thousands of entries in the php opcode cache where there will only be about 80 in the file system.

    It seems that the temporary-file strategy being used by SI Captcha doesn’t benefit from the opcode cache, and may even impair the performance since it would be recompiling files that are frequently being deleted. (This is currently seen in xCache.)

    IMO, creating the temp files is a naive design, since it doesn’t guarantee that the same web server in a cluster will serve and process the captcha. A better strategy would be to try and use the opcode variable cache, memcached, or even just store the entries in the database (to leverage the query cache which should be shared by the cluster.)

    Anyway the plugin doesn’t appear to impair the page generation, just the captcha generation. However I’m somewhat concerned in how it’s cleaning the files as well.

    It looks like the script is scanning over the entire directory with the temp files with every call to the script. This isn’t particularly efficient, and could probably be done faster by stat’ing the index file, and when the index file’s modification time exceeds the timeout, then do the full directory scan, then update the modification time of the index file. This would reduce the filesystem calls to just one per use, instead of potentially hundreds. The existing behavior likely causes the files to be kept in the operating system’s disk cache until deleted.

Viewing 1 replies (of 1 total)
  • Uncheck this setting: “Use CAPTCHA without PHP session”. This will eliminate the captcha from directly using the filesystem for storing the captcha codes. Then PHP sessions are used to store the captcha.
    If you still have performance issues, try deactivating this plugin because your server is probably overloaded anyway.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: SI CAPTCHA Anti-Spam] Performance issue, temp files contaminate php opcode cache’ is closed to new replies.