Forum Moderators: phranque
Anyone noticing performance issues after having too many rewriterules ?
How many is too many depends on your server capability (CPU speed, memory speed and size, disk speed, etc.), the backbone connection speed, and the number and time-distribution of client requests to your server. As a result, *you* will notice performance problems when and as your site gets busy.
mod_rewrite will process the pattern-matches in all RewriteRules in your .htaccess files, and process the RewriteConds only for the rules whose patterns match. If both the rule and cond patterns match, the rule will be invoked, and if it's an internal rewrite and the rule has an [L] flag on it, then mod_rewrite processing will be re-started from the top. After a complete pass through all of the rules is made and none match, mod_rewrite processing will end. If your rules do not have [L] flags on them, then all rules will be repeatedly processed and invoked until no further rules match.
I wouldn't worry about 50 rules, though. On some projects, I'd call adding 50 rules "a good start to the morning's work." :)
That said, I'm also a firm believer in making those rules' patterns as specific as as possible, and using the most efficient coding techniques possible. So it's possible that your 50 rules may be slower than my 400 rules, simply because my regex patterns are better, for example.
The top killers of performance I usually see are: