D
D
Daniel Newman2017-11-24 10:46:23
NoSQL
Daniel Newman, 2017-11-24 10:46:23

Non-blocking logging to the database. Practices and criteria. What to do?

Introductory:
- There is a set of cron tasks, with an interval of 3/5/8/10 minutes in a group of servers.
- Once every 120 minutes, they are launched at a time.
But the cron organization error is not the problem. The problem is logging and notifying developers.
How the error is generated:
- Simultaneous launch of scripts for reading and writing to the database
- for an interconnected group of lines
- on a group of servers with a time discrepancy
Result:
- Lock by lines, 5 thousand letters through Yandex PDD without a guarantee of timely delivery, within 0 - 96 hours .
- Email notifications are created about this for sending.
- Here php-fpm dies
Candidate for solution:
- There is an idea to create a row in the database, if such an error did not occur at that minute,
- Increase the value of the "number of errors" field when an error occurs again in this interval (1 minute).
- Every 5-10 minutes we will send a table-summary of errors.
I feel that I am close to inventing a bicycle, but the question is different.
How/where am I guaranteed to write 50/100/1000 INSERT/UPDATE/SELECT records per second?
What if you cluster?
Redis/Memcached/MongoDB? Ready-made production solutions for the entire task?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2017-11-24
@danielnewman

I recommend redis, you can set the lifetime on its key, there is also a PUB / SUB mechanism, but everything else will work, including prostgres and mysql. You can also use elastisearch +logstash to store logs.

A
Alexander Yudakov, 2017-11-24
@AlexanderYudakov

Candidate for solution:
- There is an idea to create a row in the database if no such error occurred at that minute,
- Increase the value of the "number of errors" field when an error occurs again in this interval (1 minute).
- Every 5-10 minutes we will send a table-summary of errors.
I feel like I'm close to inventing the bicycle...

I work with a similar bike, the flight is normal. Only repetitions are not considered in the database, but in the RAM. To avoid unnecessary IO.
What is this for? Are you saying someone will read them?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question