Problem/Motivation
Redirect module's access logging feature requires a database write for each request. This can be a performance bottleneck for high-traffic sites.
Proposed resolution
If we make this feature optional, then site admins will have the option of handling redirects without any database writes.
Create a redirect_access submodule that is optional. Let it maintain a redirect_access table with rid, timestamp, uid, hostname columns.
Drop expiration handling feature from base module and move into the submodule.
Remaining tasks
Do so for D7 and D8.
User interface changes
API changes
Data model changes
Comments
Comment #1
mfbHere's a patch adding two new settings, for disabling access logging and loop detection.
This patch also fixes what appears to be a bug in redirect_purge_inactive_redirects() - it does not purge inactive redirects if redirect_page_cache is disabled.
Comment #2
fenstratMaking the database writes optional is a good idea, however removing them all together is a better option. Marking as a duplicate of #1263832: Remove session-based flood / loop detection since it performs poorly, and has unfixable race conditions
Comment #3
mfbDisabling the access logging could still be useful for sites that don't need it or want to disable it when the database is under heavy load.
Comment #4
fenstratI'm confused @mfb, in #1263832: Remove session-based flood / loop detection since it performs poorly, and has unfixable race conditions you argue for the removal of this. Should we change back to this issue and make it optional?
Comment #5
mfbThis issue is about making two things optional: loop detection and access logging.
The other issue is only about loop detection.
Comment #6
fenstratRight ok. So given there consensus in #1263832: Remove session-based flood / loop detection since it performs poorly, and has unfixable race conditions to remove loop detection can this issue be refocused on only making redirect logging optional?
Comment #7
dave reidYes, this should definitely be refocused.
Comment #8
mfbOk rerolled the patch.
Comment #9
mfbComment #10
pere orgaI think that everytime a new variable is used, we should add it to the
redirect_variables()function.Comment #11
mfbadded to redirect_variables()
Comment #12
pere orgaIt works, thanks
Comment #13
dave reidI think this could be made a bit more clear 'access log' of redirects doesn't really match what is happening. I would prefer this is exposed in the UI more like the core statistics module counter. Something more like 'Count redirects'
Comment #14
mfbOk renamed the variable to Count redirects
Comment #17
mfbrerolled
Comment #18
dave reidComment #19
dave reidI'm actually going to take this in a separate direction. I'd rather have a separate module for handling the logging and expiration of unused redirects.
Comment #20
miro_dietikerMuch agree that supporting deletion of unused redirects should not add complexity to the basic module.
I'm still much interested in when a redirect was created and it it was used ever.
Adding a create timestamp is still subject for redirect core functionality: #1853144: Store created date/time
How about the access timestamp then?
Comment #21
dave reidaccess timestamp should still be in a separate table and not available from an entity_load() of a redirect. I was thinking a redirect_access table with rid, timestamp, uid, hostname columns for when a redirect is "logged."
Comment #22
miro_dietikerAgree this is a proper approach. Are we rescoping this issue to include the redirect_access table (or stay with expiring topic only and split that log rewrite into a separate issue)?
Comment #23
dave reidI was planning on using this issue to add the new redirect_access submodule to the 7.x-1.x codebase for 1.0 release.
Comment #24
miro_dietikerUpdated the issue summary.
Comment #25
miro_dietikerThis rework makes it related to....
Comment #26
berdirThis feature has been completely removed from the 8.x-1.x port, at least for now.
With caching of redirects enabled by default (and reliably, thanks to cache tags), it was no longer possible to rely on it.
Comment #27
dave reidI've decided I can't change something major like this in the 1.x branch, so I'll be opening a 2.x branch shortly for this new sub-module.
Comment #28
dave reidComment #29
socialnicheguru commenteddoesn't seem to apply anymore
Comment #30
chris matthews commentedThe latest patch in #17 does not apply to the latest 7.x-2.x-dev.
Comment #31
mfbRerolled.
Comment #32
mfbIt looks like 7.x-2.x and 7.x-1.x branches are the same.
Personally, I think this patch should be fine to apply on both branches. It's just adding an extra config that allows sites to reduce database writes (and in the process, disable a feature) if they want to. It's not a breaking change as far as I can tell.
I also think that re-architecting this and other things makes sense in 7.x-2.x branch, but that hasn't happened yet. In the meantime, it's useful to roll this out to existing sites now rather than waiting for 7.x-2.x to diverge and stabilize.
Comment #33
chris matthews commented@mfb, thank you. The rerolled patch in #31 to redirect.admin.inc and redirect.module does apply cleanly to both 7.x-1.x-dev and 7.x-2.x-dev. I agree with your comments, but I'll leave the issue metadata as it is for now so that someone else more experienced than myself to update as necessary.