This might sound a bit off, but here's what I have been thinking for a while now:
Use Case
You want to build an activity log for each user action on your application using database (postgreSQL) triggers on every relevant table, outputting to an activity_log table. The triggers should do the trick, but how do we eliminate the burden of every user action triggering an action on the production servers, delaying the whole application?
Purposed Architecture
What I have in mind is a complex structure where one or more secondary postgres nodes would take the entire activity_log trigger activity. The triggers would be disabled on all primary nodes (the ones the application reads and writes to) and enabled on some/all secondary nodes (let's call them "workers"). Data would be written to a primary server (no trigger runs) and replication would forward it to all other nodes. When a "worker" node get's the data, the triggers process it and update the activity_log. activity_log table should be replicated across ALL servers which means that a "worker" node should be able to read, write and send selected data upstream.
Is there anything even close to this? Is this even possible to achieve without having to rewrite a replication model from scratch?
Aucun commentaire:
Enregistrer un commentaire