emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Одной из непростых тем в DDD и микросервисной архитектуре является т.н. проблема "конкурирующих подписчиков". Это когда два причинно-зависимых события попадают на конкурирующие узлы обработки событий, и второе событие может "обогнать" первое, например, по…
Четвертая из перечисленных стратегий решения проблемы "конкурирующих подписчиков" - это "восстановить очередность обработки сообщений".
Иными словами, можно пойти другим путем, и отказаться от гарантированной очередности доставки сообщений. Но, в таком случае, подписчик сам должен будет решать, может ли он обработать поступившее сообщение, или же причинно-предшествующее сообщение еще пока не было обработано, и тогда он должен оставить поступившее сообщение в очереди. Правда, на выяснение этого требуется потратить ресурсы (где-то нужно фиксировать обработку сообщений и потом удостоверяться, что предшествующее причинное сообщение уже было обработано).
Как красиво заметил Alexey Zimarev, "мир occasionally-connected устройств по определению не упорядочен".
Такой подход применяется в Actor Model:
📝 "... модель акторов зеркально отражает систему коммутации пакетов, которая не гарантирует, что пакеты будут получены в порядке отправления. Отсутствие гарантий порядка доставки сообщений позволяет системе коммутации пакетов буферизовать пакеты, использовать несколько путей отправки пакетов, повторно пересылать повреждённые пакеты и использовать другие методы оптимизации."
- Pаздел "Никаких требований о порядке поступления сообщений" статьи "Модель акторов" Википедии
https://ru.wikipedia.org/wiki/%D0%9C%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C_%D0%B0%D0%BA%D1%82%D0%BE%D1%80%D0%BE%D0%B2#%D0%9D%D0%B8%D0%BA%D0%B0%D0%BA%D0%B8%D1%85_%D1%82%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B9_%D0%BE_%D0%BF%D0%BE%D1%80%D1%8F%D0%B4%D0%BA%D0%B5_%D0%BF%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F_%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B9
📝 "Messages in the Actor model are generalizations of packets in Internet computing in that they need not be received in the order sent. Not implementing the order of delivery, allows packet switching to buffer packets, use multiple paths to send packets, resend damaged packets, and to provide other optimizations.
For example, Actors are allowed to pipeline the processing of messages. What this means is that in the course of processing a message m1, an Actor can designate how to process the next message, and then in fact begin processing another message m2 before it has finished processing m1. Just because an Actor is allowed to pipeline the processing of messages does not mean that it must pipeline the processing. Whether a message is pipelined is an engineering tradeoff."
- "Actor Model of Computation: Scalable Robust Information Systems" by Carl Hewitt
https://arxiv.org/abs/1008.1459
#DDD #Microservices #DistributedSystems
Иными словами, можно пойти другим путем, и отказаться от гарантированной очередности доставки сообщений. Но, в таком случае, подписчик сам должен будет решать, может ли он обработать поступившее сообщение, или же причинно-предшествующее сообщение еще пока не было обработано, и тогда он должен оставить поступившее сообщение в очереди. Правда, на выяснение этого требуется потратить ресурсы (где-то нужно фиксировать обработку сообщений и потом удостоверяться, что предшествующее причинное сообщение уже было обработано).
Как красиво заметил Alexey Zimarev, "мир occasionally-connected устройств по определению не упорядочен".
Такой подход применяется в Actor Model:
📝 "... модель акторов зеркально отражает систему коммутации пакетов, которая не гарантирует, что пакеты будут получены в порядке отправления. Отсутствие гарантий порядка доставки сообщений позволяет системе коммутации пакетов буферизовать пакеты, использовать несколько путей отправки пакетов, повторно пересылать повреждённые пакеты и использовать другие методы оптимизации."
- Pаздел "Никаких требований о порядке поступления сообщений" статьи "Модель акторов" Википедии
https://ru.wikipedia.org/wiki/%D0%9C%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C_%D0%B0%D0%BA%D1%82%D0%BE%D1%80%D0%BE%D0%B2#%D0%9D%D0%B8%D0%BA%D0%B0%D0%BA%D0%B8%D1%85_%D1%82%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B9_%D0%BE_%D0%BF%D0%BE%D1%80%D1%8F%D0%B4%D0%BA%D0%B5_%D0%BF%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F_%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B9
📝 "Messages in the Actor model are generalizations of packets in Internet computing in that they need not be received in the order sent. Not implementing the order of delivery, allows packet switching to buffer packets, use multiple paths to send packets, resend damaged packets, and to provide other optimizations.
For example, Actors are allowed to pipeline the processing of messages. What this means is that in the course of processing a message m1, an Actor can designate how to process the next message, and then in fact begin processing another message m2 before it has finished processing m1. Just because an Actor is allowed to pipeline the processing of messages does not mean that it must pipeline the processing. Whether a message is pipelined is an engineering tradeoff."
- "Actor Model of Computation: Scalable Robust Information Systems" by Carl Hewitt
https://arxiv.org/abs/1008.1459
#DDD #Microservices #DistributedSystems
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Четвертая из перечисленных стратегий решения проблемы "конкурирующих подписчиков" - это "восстановить очередность обработки сообщений". Иными словами, можно пойти другим путем, и отказаться от гарантированной очередности доставки сообщений. Но, в таком случае…
Тут нужно сделать короткое отступление. Хотя, как говорилось ранее, "Хьюитт был против включения требований о том, что сообщения должны прибывать в том порядке, в котором они отправлены на модель актора", в современных реализациях Actor Model mailbox представлен как FIFO-queue:
📝 "One of the guarantees of the Actor model is sequential message delivery. That is, by default actor mailboxes are first-in, first-out (FIFO) channels. When a message arrives through the actor’s channel, it will be received in the order in which it was sent. Thus, if actor A sends a message to actor B and then actor A sends a second message to actor B, the message that was sent first will be the first message received by actor B."
Однако, вопрос все-равно остается открытым:
📝 "What if you introduce a third actor, C? Now actor A and actor C both send one or more messages to actor B. There is no guarantee which message actor B will receive first, either the first from actor A or the first from actor C. Nevertheless, the first message from actor A will always be received by actor B before the second message that actor A sends, and the first message from actor C will always
be received by actor B before the second message that actor C sends...
What is implied? Actors must be prepared to accept and reject messages based on their current state, which is reflected by the order in which previous messages were received. Sometimes a latent message could be accepted even if it is not perfect timing, but the actor’s reaction to the latent message may have to carefully take into account its current state beforehand. This may be dealt with more gracefully by using the actors become() capabilities."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "5. Messaging Channels :: Point-to-Point Channel"
Кроме того,
📝 "Because individual messages may follow different routes, some messages are likely to pass through the processing steps sooner than others, resulting in the messages getting out of order. However, some subsequent processing steps do require in-sequence processing of messages, for example to maintain referential integrity.
One common way things get out of sequence is the fact that different messages may take different processing paths. Let's look at a simple example. Let's assume we are dealing with a numbered sequence of messages. If all even numbered messages have to undergo a special transformation whereas all odd numbered messages can be passed right through, then odd numbered messages will appear on the resulting channel while the even ones queue up at the transformation. If the transformation is quite slow, all odd messages may appear on the output channel before a single even message makes it, bringing the sequence completely out of order.
To avoid getting the messages out of order, we could introduce a loop-back (acknowledgment) mechanism that makes sure that only one message at a time passes through the system. The next message will not be sent until the last one is done processing. This conservative approach will resolve the issue, but has two significant drawbacks. First, it can slow the system significantly. If we have a large number of parallel processing units, we would severely underutilize the processing power. In many instances, the reason for parallel processing is that we need to increase performance, so throttling traffic to one message at a time would complete erase the purpose of the solution. The second issue is that this approach requires us to have control over messages being sent into the processing units. However, often we find ourselves at the receiving end of an out-of-sequence message stream without having control over the message origin."
- "Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions" by Gregor Hohpe, Bobby Woolf
#DDD #Microservices #DistributedSystems #EIP
📝 "One of the guarantees of the Actor model is sequential message delivery. That is, by default actor mailboxes are first-in, first-out (FIFO) channels. When a message arrives through the actor’s channel, it will be received in the order in which it was sent. Thus, if actor A sends a message to actor B and then actor A sends a second message to actor B, the message that was sent first will be the first message received by actor B."
Однако, вопрос все-равно остается открытым:
📝 "What if you introduce a third actor, C? Now actor A and actor C both send one or more messages to actor B. There is no guarantee which message actor B will receive first, either the first from actor A or the first from actor C. Nevertheless, the first message from actor A will always be received by actor B before the second message that actor A sends, and the first message from actor C will always
be received by actor B before the second message that actor C sends...
What is implied? Actors must be prepared to accept and reject messages based on their current state, which is reflected by the order in which previous messages were received. Sometimes a latent message could be accepted even if it is not perfect timing, but the actor’s reaction to the latent message may have to carefully take into account its current state beforehand. This may be dealt with more gracefully by using the actors become() capabilities."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "5. Messaging Channels :: Point-to-Point Channel"
Кроме того,
📝 "Because individual messages may follow different routes, some messages are likely to pass through the processing steps sooner than others, resulting in the messages getting out of order. However, some subsequent processing steps do require in-sequence processing of messages, for example to maintain referential integrity.
One common way things get out of sequence is the fact that different messages may take different processing paths. Let's look at a simple example. Let's assume we are dealing with a numbered sequence of messages. If all even numbered messages have to undergo a special transformation whereas all odd numbered messages can be passed right through, then odd numbered messages will appear on the resulting channel while the even ones queue up at the transformation. If the transformation is quite slow, all odd messages may appear on the output channel before a single even message makes it, bringing the sequence completely out of order.
To avoid getting the messages out of order, we could introduce a loop-back (acknowledgment) mechanism that makes sure that only one message at a time passes through the system. The next message will not be sent until the last one is done processing. This conservative approach will resolve the issue, but has two significant drawbacks. First, it can slow the system significantly. If we have a large number of parallel processing units, we would severely underutilize the processing power. In many instances, the reason for parallel processing is that we need to increase performance, so throttling traffic to one message at a time would complete erase the purpose of the solution. The second issue is that this approach requires us to have control over messages being sent into the processing units. However, often we find ourselves at the receiving end of an out-of-sequence message stream without having control over the message origin."
- "Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions" by Gregor Hohpe, Bobby Woolf
#DDD #Microservices #DistributedSystems #EIP
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Тут нужно сделать короткое отступление. Хотя, как говорилось ранее, "Хьюитт был против включения требований о том, что сообщения должны прибывать в том порядке, в котором они отправлены на модель актора", в современных реализациях Actor Model mailbox представлен…
Решение?
📝 "While not discussed in detail here, Message Metadata can be used to achieve causal consistency [AMC-Causal Consistency https://queue.acm.org/detail.cfm?id=2610533 ] among Messages (130) that must be replicated across a network with full ordering preserved [Bolt-on Causal Consistency http://www.bailis.org/papers/bolton-sigmod2013.pdf ]."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "10. System Management and Infrastructure :: Message Metadata/History"
📝 "Even so, a technique called causal consistency [AMC-Causal Consistency https://queue.acm.org/detail.cfm?id=2610533 ] can be used to achieve the same."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "10. System Management and Infrastructure :: Message Journal/Store"
📝 "To see the full power that results from using Domain Events , consider the concept of causal consistency. A business domain provides causal consistency if its operations that are causally related —one operation causes another—are seen by every dependent node of a distributed system in the same order [Causal https://queue.acm.org/detail.cfm?id=2610533 ] . This means that causally related operations must occur in a specific order, and thus one thing cannot happen unless another thing happens before it. Perhaps this means that one Aggregate cannot be created or modified until it is clear that a specific operation occurred to another
Aggregate."
- "Domain-Driven Design Distilled" by Vaughn Vernon
Посмотреть вживую обеспечение Causal Consistency на уровне подписчика можно в EventSourcing Framework:
- https://eventsourcing.readthedocs.io/en/v8.3.0/topics/process.html#causal-dependencies
Реализация:
- https://github.com/johnbywater/eventsourcing/blob/fd73c5dbd97c0ae759c59f7bb0700afb12db7532/eventsourcing/application/process.py#L273
Собственно, Causal является промежуточным уровнем строгости согласованности, чтобы избежать строгую линеаризацию сообщений (которая часто избыточна) из соображений сохранения параллелизма и повышения производительности, но при этом, не допускать параллелизма в потоках причинно-зависимых сообщений (где очередность сообщений, действительно, востребована).
Обычно идентификатором потока (streamId) выступает идентификатор агрегата. А идентификатором последовательности события в этом потоке (position) обычно выступает номер версии агрегата:
https://github.com/johnbywater/eventsourcing/blob/fd73c5dbd97c0ae759c59f7bb0700afb12db7532/eventsourcing/application/process.py#L82
#DDD #Microservices #DistributedSystems #EIP
📝 "While not discussed in detail here, Message Metadata can be used to achieve causal consistency [AMC-Causal Consistency https://queue.acm.org/detail.cfm?id=2610533 ] among Messages (130) that must be replicated across a network with full ordering preserved [Bolt-on Causal Consistency http://www.bailis.org/papers/bolton-sigmod2013.pdf ]."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "10. System Management and Infrastructure :: Message Metadata/History"
📝 "Even so, a technique called causal consistency [AMC-Causal Consistency https://queue.acm.org/detail.cfm?id=2610533 ] can be used to achieve the same."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "10. System Management and Infrastructure :: Message Journal/Store"
📝 "To see the full power that results from using Domain Events , consider the concept of causal consistency. A business domain provides causal consistency if its operations that are causally related —one operation causes another—are seen by every dependent node of a distributed system in the same order [Causal https://queue.acm.org/detail.cfm?id=2610533 ] . This means that causally related operations must occur in a specific order, and thus one thing cannot happen unless another thing happens before it. Perhaps this means that one Aggregate cannot be created or modified until it is clear that a specific operation occurred to another
Aggregate."
- "Domain-Driven Design Distilled" by Vaughn Vernon
Посмотреть вживую обеспечение Causal Consistency на уровне подписчика можно в EventSourcing Framework:
- https://eventsourcing.readthedocs.io/en/v8.3.0/topics/process.html#causal-dependencies
Реализация:
- https://github.com/johnbywater/eventsourcing/blob/fd73c5dbd97c0ae759c59f7bb0700afb12db7532/eventsourcing/application/process.py#L273
Собственно, Causal является промежуточным уровнем строгости согласованности, чтобы избежать строгую линеаризацию сообщений (которая часто избыточна) из соображений сохранения параллелизма и повышения производительности, но при этом, не допускать параллелизма в потоках причинно-зависимых сообщений (где очередность сообщений, действительно, востребована).
Обычно идентификатором потока (streamId) выступает идентификатор агрегата. А идентификатором последовательности события в этом потоке (position) обычно выступает номер версии агрегата:
https://github.com/johnbywater/eventsourcing/blob/fd73c5dbd97c0ae759c59f7bb0700afb12db7532/eventsourcing/application/process.py#L82
#DDD #Microservices #DistributedSystems #EIP
queue.acm.org
Don’t Settle for Eventual Consistency - ACM Queue
Geo-replicated storage provides copies of the same data at multiple, geographically distinct locations. Facebook, for example, geo-replicates its data (profiles, friends lists, likes, etc.) to data centers on the east and west coasts of the United States…
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Решение? 📝 "While not discussed in detail here, Message Metadata can be used to achieve causal consistency [AMC-Causal Consistency https://queue.acm.org/detail.cfm?id=2610533 ] among Messages (130) that must be replicated across a network with full ordering…
📝 "Note that just saving the Domain Event in its causal order doesn’t guarantee that it will arrive at other distributed nodes in the same order. Thus, it is also the responsibility of the consuming Bounded Context to recognize proper causality. It might be the Domain Event type itself that can indicate causality, or it may be metadata associated with the Domain Event, such as a sequence or causal identifier. The sequence or causal identifier would indicate what caused this Domain Event, and if the cause was not yet seen, the consumer must wait to apply the newly arrived event until its cause arrives. In some cases it is possible to ignore latent Domain Events that have already been superseded by the actions associated with a later one; in this case causality has a dismissible impact [об этом способе уже говорилось ранее, прим. моё]."
- "Domain-Driven Design Distilled" by Vaughn Vernon, Chapter "6. Tactical Design with Domain Events:: Designing, Implementing, and Using Domain Events"
📝 "The first option is to use message sessions, a feature of the Azure Service Bus. If you use message sessions, this guarantees that messages within a session are delivered in the same order that they were sent.
The second alternative is to modify the handlers within the application to detect out-of-order messages through the use of sequence numbers or timestamps added to the messages when they are sent. If the receiving handler detects an out-of-order message, it rejects the message and puts it back onto the queue or topic to be processed later, after it has processed the messages that were sent before the rejected message."
- "CQRS Journey" by Dominic Betts, Julián Domínguez, Grigori Melnik, Fernando Simonazzi, Mani Subramanian, Chapter "Journey 6: Versioning Our System :: Message ordering"
https://docs.microsoft.com/ru-ru/previous-versions/msp-n-p/jj591565(v=pandp.10)#message-ordering
📝 "Actors must be prepared to accept and reject messages based on their current state, which is reflected by the order in which previous messages were received. Sometimes a latent message could be accepted even if it is not perfect timing, but the actor’s reaction to the latent message may have to carefully take into account its current state beforehand. This may be dealt with more gracefully by using the actors become() capabilities."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "5. Messaging Channels :: Point-to-Point Channel"
#DDD #Microservices #DistributedSystems
- "Domain-Driven Design Distilled" by Vaughn Vernon, Chapter "6. Tactical Design with Domain Events:: Designing, Implementing, and Using Domain Events"
📝 "The first option is to use message sessions, a feature of the Azure Service Bus. If you use message sessions, this guarantees that messages within a session are delivered in the same order that they were sent.
The second alternative is to modify the handlers within the application to detect out-of-order messages through the use of sequence numbers or timestamps added to the messages when they are sent. If the receiving handler detects an out-of-order message, it rejects the message and puts it back onto the queue or topic to be processed later, after it has processed the messages that were sent before the rejected message."
- "CQRS Journey" by Dominic Betts, Julián Domínguez, Grigori Melnik, Fernando Simonazzi, Mani Subramanian, Chapter "Journey 6: Versioning Our System :: Message ordering"
https://docs.microsoft.com/ru-ru/previous-versions/msp-n-p/jj591565(v=pandp.10)#message-ordering
📝 "Actors must be prepared to accept and reject messages based on their current state, which is reflected by the order in which previous messages were received. Sometimes a latent message could be accepted even if it is not perfect timing, but the actor’s reaction to the latent message may have to carefully take into account its current state beforehand. This may be dealt with more gracefully by using the actors become() capabilities."
- "Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka" by Vaughn Vernon, Chapter "5. Messaging Channels :: Point-to-Point Channel"
#DDD #Microservices #DistributedSystems
Docs
Journey 6: Versioning Our System
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
📝 "Note that just saving the Domain Event in its causal order doesn’t guarantee that it will arrive at other distributed nodes in the same order. Thus, it is also the responsibility of the consuming Bounded Context to recognize proper causality. It might be…
Родственные EIP patterns:
- "Correlation Identifier"
https://www.enterpriseintegrationpatterns.com/patterns/messaging/CorrelationIdentifier.html
- "Message Sequence"
https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageSequence.html
Применяется в том числе и в Event Sourcing.
В метаданных eventstore есть переменные $causationid and $correlationid.
📝 "The are both really simple patterns I have never quite understood why they end up so misunderstood.
Let's say every message has 3 ids. 1 is its id. Another is correlation the last it causation.
The rules are quite simple. If you are responding to a message, you copy its correlation id as your correlation id, its message id is your causation id.
This allows you to see an entire conversation (correlation id) or to see what causes what (causation id).
Cheers,
Greg Young"
https://discuss.eventstore.com/t/causation-or-correlation-id/828/4
Примеры:
- https://github.com/microsoftarchive/cqrs-journey/blob/6ffd9a8c8e865a9f8209552c52fa793fbd496d1f/noscripts/CreateDatabaseObjects.sql#L57-L62
- https://github.com/kgrzybek/modular-monolith-with-ddd/blob/4e2d66d16f97b3c863fbecd072dad52338516882/src/Modules/Payments/Infrastructure/AggregateStore/SqlStreamAggregateStore.cs#L44-L45
#DDD #Microservices #DistributedSystems #EIP
- "Correlation Identifier"
https://www.enterpriseintegrationpatterns.com/patterns/messaging/CorrelationIdentifier.html
- "Message Sequence"
https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageSequence.html
Применяется в том числе и в Event Sourcing.
В метаданных eventstore есть переменные $causationid and $correlationid.
📝 "The are both really simple patterns I have never quite understood why they end up so misunderstood.
Let's say every message has 3 ids. 1 is its id. Another is correlation the last it causation.
The rules are quite simple. If you are responding to a message, you copy its correlation id as your correlation id, its message id is your causation id.
This allows you to see an entire conversation (correlation id) or to see what causes what (causation id).
Cheers,
Greg Young"
https://discuss.eventstore.com/t/causation-or-correlation-id/828/4
Примеры:
- https://github.com/microsoftarchive/cqrs-journey/blob/6ffd9a8c8e865a9f8209552c52fa793fbd496d1f/noscripts/CreateDatabaseObjects.sql#L57-L62
- https://github.com/kgrzybek/modular-monolith-with-ddd/blob/4e2d66d16f97b3c863fbecd072dad52338516882/src/Modules/Payments/Infrastructure/AggregateStore/SqlStreamAggregateStore.cs#L44-L45
#DDD #Microservices #DistributedSystems #EIP
Event Store Discuss Forum
causation or correlation id?
Here https://groups.google.com/d/msg/event-store/9dyhwgL2hVA/wFU62XSQtCYJ James Nugent say that when storing commands, events produced by it could have the command id as correlation id. What would a causation id be then? To me it seems that a command causes…
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Одной из непростых тем в DDD и микросервисной архитектуре является т.н. проблема "конкурирующих подписчиков". Это когда два причинно-зависимых события попадают на конкурирующие узлы обработки событий, и второе событие может "обогнать" первое, например, по…
Шпаргалка по EIP-паттернам:
"Enterprise Integration Patterns Tutorial Reference Chart"
https://www.enterpriseintegrationpatterns.com/download/EIPTutorialReferenceChart.pdf
#DDD #Microservices #DistributedSystems #EIP
"Enterprise Integration Patterns Tutorial Reference Chart"
https://www.enterpriseintegrationpatterns.com/download/EIPTutorialReferenceChart.pdf
#DDD #Microservices #DistributedSystems #EIP
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Одной из непростых тем в DDD и микросервисной архитектуре является т.н. проблема "конкурирующих подписчиков". Это когда два причинно-зависимых события попадают на конкурирующие узлы обработки событий, и второе событие может "обогнать" первое, например, по…
Но даже если подписчик всего один, и сообщения доставляются последовательно, то и тогда очередность обработки сообщений может быть нарушена. Пример из NATS-Streaming Server:
📝 "With the redelivery feature, order can’t be guaranteed, since by definition server will resend messages that have not been acknowledged after a period of time. Suppose your consumer receives messages 1, 2 and 3, does not acknowledge 2. Then message 4 is produced, server sends this message to the consumer. The redelivery timer then kicks in and server will resend message 2. The consumer would see messages: 1, 2, 3, 4, 2, 5, etc...
In conclusion, the server does not offer this guarantee although it tries to redeliver messages first thing on startup. That being said, if the durable is stalled (number of outstanding messages >= MaxInflight), then the redelivery will also be stalled, and new messages will be allowed to be sent. When the consumer resumes acking messages, then it may receive redelivered and new messages interleaved (new messages will be in order though)."
- nats-streaming-server, issue #187 "Order of delivery", comment by Ivan Kozlovic
https://github.com/nats-io/nats-streaming-server/issues/187#issuecomment-257024506
#DDD #Microservices #DistributedSystems
📝 "With the redelivery feature, order can’t be guaranteed, since by definition server will resend messages that have not been acknowledged after a period of time. Suppose your consumer receives messages 1, 2 and 3, does not acknowledge 2. Then message 4 is produced, server sends this message to the consumer. The redelivery timer then kicks in and server will resend message 2. The consumer would see messages: 1, 2, 3, 4, 2, 5, etc...
In conclusion, the server does not offer this guarantee although it tries to redeliver messages first thing on startup. That being said, if the durable is stalled (number of outstanding messages >= MaxInflight), then the redelivery will also be stalled, and new messages will be allowed to be sent. When the consumer resumes acking messages, then it may receive redelivered and new messages interleaved (new messages will be in order though)."
- nats-streaming-server, issue #187 "Order of delivery", comment by Ivan Kozlovic
https://github.com/nats-io/nats-streaming-server/issues/187#issuecomment-257024506
#DDD #Microservices #DistributedSystems
GitHub
Order of delivery · Issue #187 · nats-io/nats-streaming-server
Does nats-streaming-server make any guarantees about the order of messages delivered to a subscriber? E.g. at a base level, if a single publisher writes messages A, B, C to the same topic, will a s...
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Одной из непростых тем в DDD и микросервисной архитектуре является т.н. проблема "конкурирующих подписчиков". Это когда два причинно-зависимых события попадают на конкурирующие узлы обработки событий, и второе событие может "обогнать" первое, например, по…
Кстати, проблема очередности доставки сообщений хорошо описана в главе "Projections and Queries :: Building read models from events :: Subnoscriptions" книги "Hands-On Domain-Driven Design with .NET Core: Tackling complexity in the heart of software by putting DDD principles into practice" by Alexey Zimarev ( @zimareff )
https://www.amazon.com/Hands-Domain-Driven-Design-NET-ebook/dp/B07C5WSR9B
И он добавил несколько интересных аргументов в чат канала:
https://news.1rj.ru/str/emacsway_chat/85
P.S.: это один из тех людей, кому я искренне благодарен за влияние на мое профессиональное развитие.
#DDD #Microservices #DistributedSystems
https://www.amazon.com/Hands-Domain-Driven-Design-NET-ebook/dp/B07C5WSR9B
И он добавил несколько интересных аргументов в чат канала:
https://news.1rj.ru/str/emacsway_chat/85
P.S.: это один из тех людей, кому я искренне благодарен за влияние на мое профессиональное развитие.
#DDD #Microservices #DistributedSystems
Telegram
Alexey Zimarev in emacsway-chat
Ну, я имею ввиду вообще :) Actor model во многих ситуациях может быть полезным паттерном.
Немного юмора в тему "Совершенного Кода":
https://github.com/kelseyhightower/nocode
#SoftwareDesign #CleanArchitecture
https://github.com/kelseyhightower/nocode
#SoftwareDesign #CleanArchitecture
GitHub
GitHub - kelseyhightower/nocode: The best way to write secure and reliable applications. Write nothing; deploy nowhere.
The best way to write secure and reliable applications. Write nothing; deploy nowhere. - kelseyhightower/nocode
Кстати, Яндекс-Переводчик знает толк в "Совершенстве" 🙂
Уже старая, но невероятно полезная статья для тех, кто впервые работает на заказчика из США:
https://bulochnikov.livejournal.com/2326301.html
#Career
https://bulochnikov.livejournal.com/2326301.html
#Career
Livejournal
Разница менталитетов и национальных деловых культур.
1-- Запад есть Запад, Восток есть Восток. О разнице культур и взаимодействии внутри международной компании Разница менталитетов и национальных деловых культур тема вечная и актуальности своей не теряющая: чужая душа по-прежнему потемки, а чужая заокеанная…
Если вдруг кто пропустил эту новость - вышло второе издание бестселлера "The Pragmatic Programmer: your journey to mastery, 20th Anniversary Edition" (2nd Edition) by David Thomas: https://www.amazon.com/Pragmatic-Programmer-journey-mastery-Anniversary/dp/0135957052/
Автор - один из 17 подписантов Agile-manifesto и его соавтор.
Кстати, Dave тоже ударился в функциональное программирование, и написал книгу "Programming Elixir".
А так же он был редактором книги Джо Армстронга по Эрлангу:
"Dave Thomas edited my Erlang book"
https://web.archive.org/web/20170830231254/http://joearms.github.io/2013/05/31/a-week-with-elixir.html
#Agile #Career #FunctionalProgramming
Автор - один из 17 подписантов Agile-manifesto и его соавтор.
Кстати, Dave тоже ударился в функциональное программирование, и написал книгу "Programming Elixir".
А так же он был редактором книги Джо Армстронга по Эрлангу:
"Dave Thomas edited my Erlang book"
https://web.archive.org/web/20170830231254/http://joearms.github.io/2013/05/31/a-week-with-elixir.html
#Agile #Career #FunctionalProgramming
📝 "A good architecture is characterized by crisp abstractions, a good separation of concerns, a clear distribution of responsibilities, and simplicity.
All else is details."
- Grady Booch. Позавчера.
https://twitter.com/Grady_Booch/status/1301810362119905285?s=19
[UPDATED]: Там весь тред заслуживает на прочтение.
#SoftwareDesign #SoftwareArchitecture
All else is details."
- Grady Booch. Позавчера.
https://twitter.com/Grady_Booch/status/1301810362119905285?s=19
[UPDATED]: Там весь тред заслуживает на прочтение.
#SoftwareDesign #SoftwareArchitecture
X (formerly Twitter)
Grady Booch (@Grady_Booch) on X
A good architecture is characterized by crisp abstractions, a good separation of concerns, a clear distribution of responsibilities, and simplicity.
All else is details.
All else is details.
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
📝 "A good architecture is characterized by crisp abstractions, a good separation of concerns, a clear distribution of responsibilities, and simplicity. All else is details." - Grady Booch. Позавчера. https://twitter.com/Grady_Booch/status/1301810362119905285?s=19…
В том же треде:
📝 "All architecture is design, but not all design is architecture.
Architecture represents the set of significant design decisions that shape the form and the function of a system, where significant is measured by cost of change."
- Grady Booch
https://twitter.com/Grady_Booch/status/1301810380675588096?s=19
#SoftwareDesign #SoftwareArchitecture
📝 "All architecture is design, but not all design is architecture.
Architecture represents the set of significant design decisions that shape the form and the function of a system, where significant is measured by cost of change."
- Grady Booch
https://twitter.com/Grady_Booch/status/1301810380675588096?s=19
#SoftwareDesign #SoftwareArchitecture
X (formerly Twitter)
Grady Booch (@Grady_Booch) on X
All architecture is design, but not all design is architecture.
Architecture represents the set of significant design decisions that shape the form and the function of a system, where significant is measured by cost of change.
Architecture represents the set of significant design decisions that shape the form and the function of a system, where significant is measured by cost of change.
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
📝 "A good architecture is characterized by crisp abstractions, a good separation of concerns, a clear distribution of responsibilities, and simplicity. All else is details." - Grady Booch. Позавчера. https://twitter.com/Grady_Booch/status/1301810362119905285?s=19…
Там же:
📝 "You cannot reduce the complexity of a software-intensive systems; the best you can do is manage it."
- Grady Booch
https://twitter.com/Grady_Booch/status/1301810363734736896?s=19
#SoftwareDesign #SoftwareArchitecture
📝 "You cannot reduce the complexity of a software-intensive systems; the best you can do is manage it."
- Grady Booch
https://twitter.com/Grady_Booch/status/1301810363734736896?s=19
#SoftwareDesign #SoftwareArchitecture
Twitter
Grady Booch
You cannot reduce the complexity of a software-intensive systems; the best you can do is manage it.
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
📝 "A good architecture is characterized by crisp abstractions, a good separation of concerns, a clear distribution of responsibilities, and simplicity. All else is details." - Grady Booch. Позавчера. https://twitter.com/Grady_Booch/status/1301810362119905285?s=19…
Гы... недавно был холиварчик в архитекторской группе на эту тему. Там же:
📝 "A software architect who does not code is like a cook who does not eat."
- Grady Booch
https://twitter.com/Grady_Booch/status/1301810374598033408?s=19
#SoftwareDesign #SftwareArchitecture
📝 "A software architect who does not code is like a cook who does not eat."
- Grady Booch
https://twitter.com/Grady_Booch/status/1301810374598033408?s=19
#SoftwareDesign #SftwareArchitecture
Twitter
Grady Booch
A software architect who does not code is like a cook who does not eat.
📝 "An honest estimate is not a date. It is always a range of dates with probabilities assigned to the range."
- Robert C. Martin
https://twitter.com/unclebobmartin/status/1302600840138485760?s=19
#Agile
- Robert C. Martin
https://twitter.com/unclebobmartin/status/1302600840138485760?s=19
#Agile
Twitter
Uncle Bob Martin
An honest estimate is not a date. It is always a range of dates with probabilities assigned to the range.
Знаете этого парня, да?
- https://leanpub.com/u/johnbywater
А его книгу?
- https://leanpub.com/dddwithpython
#DDD #DistributedSystems #EIP #EDA #Microservices
- https://leanpub.com/u/johnbywater
А его книгу?
- https://leanpub.com/dddwithpython
#DDD #DistributedSystems #EIP #EDA #Microservices
Leanpub
Event Sourcing in Python
A pattern language for event sourced applications and reliable distributed systems. Examples are written in the Python programming language. Now includes event-oriented introductions to the pattern language scheme of Christopher Alexander, the process philosophy…
Две превосходные статьи о том, как устроено сжатие данных в time-series расширении TimescaleDB для PostreSQL.
- https://blog.timescale.com/blog/time-series-compression-algorithms-explained/
- https://blog.timescale.com/blog/building-columnar-compression-in-a-row-oriented-database/
#Database #PosgreSQL #HighLoad #Scaling
- https://blog.timescale.com/blog/time-series-compression-algorithms-explained/
- https://blog.timescale.com/blog/building-columnar-compression-in-a-row-oriented-database/
#Database #PosgreSQL #HighLoad #Scaling
Timescale Blog
Time-series compression algorithms, explained
Delta-delta encoding, Simple-8b, XOR-based compression, and more - these algorithms aren't magic, but combined they can save over 90% of storage costs and speed up queries. Here’s how they work.