7 karma · joined Aug 29, 2014 (12y ago) · 13 submissions
comment 6y ago · link · parent
comment 9y ago · link · parent
We are a B2B SaaS startup building a real-time fee tracking and analytics platform for the legal industry.
Tech: React, Redux, AWS, Python, Django, Postgres, Linux
https://www.apperio.com/careers/engineering/front-end-engine...
comment 9y ago · link · parent
> "add a single function to increment these counters based on the name of the event"
While the sentiment is a good one, I would warn against introducing counters in the database like this and incrementing them on every execution of a function. If transactions volumes are high, then depending on the locking strategy in your database, this could lead to blocking and locking. Operations that could previously execute in parallel independently now have to compete for a write lock on this shared counter, which could slow down throughput. In the worst case, if there are scenarios where two counters can be incremented inside different transactions, but in different sequences (not inconceivable in a legacy code), then you could introduce deadlocks.
Adding database writes to a legacy codebase is not without risk.
If volumes are low you might get away with it for a long time, but a better strategy would probably just to log the events to a file and aggregate them when you need them.
comment 9y ago · link · parent
comment 10y ago · link · parent
http://www.huddle.com - SaaS Collaboration Platform
Senior Systems Engineer
Product Manager
Software Engineering Graduate
comment 12y ago · link · parent
Anyone reading this may be interested in the related concept of the 'circuit breaker' technique employed by things such as Hystrix (Netflix), to avoid getting into this state.
Not a solution per se, but the simple philosophy is to set yourself up to fail fast: when back pressure reaches some threshold the 'circuit opens' and your servers immediately respond to new requests with an error, instead of ingesting huge numbers of requests which flood your internal queues or overload your infrastructure.
https://raw.githubusercontent.com/wiki/Netflix/Hystrix/image...