9

whenever a slave loses its connection to the master, this slave immediately becomes unavailable That is not necessarily true. The CAP argument assumes that when the network is partitioned, there may be clients on both sides of the partition. ...So I'm keeping my consistency and I'm keeping my availability in the system. The CAP argument also assumes ...


7

In the aerospace industry there is a file format called IRIG 106 Chapter 10. It uses a multiple-channel packet metaphor. One of the channels contains Time packets, which are used as a referent. One of the interesting features of Chapter 10 is that (similar to TCP/IP), packets can arrive in any order. There are sequence numbers in the packets so that ...


6

"Atomic" means that the process appears to have happened instantaneously, or at least it cannot be interrupted. Its possible to have atomic distributed processes, but its not easy, e.g. you could do the following: Start a SQL transaction Add the user to the database Send the email Rollback the transaction if the email failed to send Commit the transaction ...


6

Never manipulate the actual time time or speed of the system you are testing on just to test time logic. It's hard to get right and may have lots of unforeseen side effects. Instead, decouple all time-related functionality in your code base; business code will use a trivial implementation that just delegates to the normal functions, and during tests you can ...


5

I believe that the problem you referring to is connected to single class characteristics and level of class decomposition established for a considered problem. Each of your examples sounds reasonable taking into account class characteristics. On the other hand, there are plenty of scenarios that data is bound to logic. In such case it's called rather class ...


5

Short answer: No. Look around the world: as you surely know, currently millions of PCs or other network devices have been "hacked", they got malware installed and are incorporated into botnet farms, abused for spamming or other malware distribution, often without knowledge of their owner. Those computers are nothing but "nodes with independent storage", and ...


5

The basic concepts are orthogonal, however, they are related. One has to do with the availability of your application, and the other has to do with the correctness of your application. Remember, there are differing levels of faults (also known as bugs). Fault Tolerance "Everything fails, all the time" -- Werner Vogels, Amazon CTO When you design for ...


4

If you are literally talking about business logic as in, it's for a business and not domain logic in general, I find most entities have logic imposed on them by outside influencers or because of the context (We give you a discount if ...). That's why business programming can be so frustrating because things can appear to be arbitrary. Entities don't always ...


4

Since you mentioned SQL server: according to this former DBA.SE post, schema changes can (and should) be put into transactions. This gives you the ability to design your migrations just like any other form of concurrent writes to your DB - you start a transaction, and when it fails, you roll it back. That prevents at least some of the worst database ...


4

Your solution is the obvious one. When each service receives a heartbeat from one of it's sources, note the source and time, and when that service would send a heartbeat (to it's sinks), it checks that all it's sources are alive. If you have optional sources, the "are my sources alive" becomes more tricky, but you presumably have dealt with that in how it ...


4

Use environment variables. They've existed for decades and all current (and past) tools support it, including Docker, Kubernetes and the like.


4

You've got options. Bare Metal/Standard Virtual Machines If you are on bare metal (getting rarer these days, but still common enough in some industries), you can always have an instance of your discovery service on each machine. Since just about all of them handle clustering, you just need to look at localhost for your discovery service. Dockerization ...


3

An easy solution would be to split the counter in N different "buckets", each containing a number X/N (rounding apart) where X is the initial value of the counter. Each thread would then pick a random bucket and decrease its value. If the value of the bucket is already 0, the thread can try to access the next bucket and repeat. You are not writing anything ...


3

What I would try for your case is to use a distributed database approach, shared among all players. Any "state machine" could be mapped to a database, and for a simple cards game the database will probably be so small you can replicate it quickly whenever a new player arrives. For mobile devices, your know surely there are lots of db systems available, the ...


3

Personally I dislike a self-serve approach, IMHO it's much more difficult to manage reliably distribution of tasks among nodes with a distributed intelligence since the local logic doesn't have the global view of the system for its decisions. Redistributing entities when new nodes are added is just one example. The apparent system scalability which might ...


3

Once upon a time, there was a great war being waged between two mighty armies, the CISCites and the RISCites. The men of RISC believed that their forces were mightier, for their instruction sets were simpler. The lumbering CISCs, they said, had to have a heavy translation layer in between the instruction set and the actual execution, in which instructions ...


3

For a distributed system, you would either: a) Use "subtract amount or return error if you can't", where the code responsible for baz returns an error if the result would've been negative (or returns "success" if there wasn't an error) b) Use the equivalent of locking; where the code responsible for baz has an "acquire baz" and "release baz" that need to ...


2

I think the reason this isn't done more often is because you're sending code along with your data, and therefore you no longer have total control over the code. Maintaining security over your operations would be a real challenge. This is not true of data, because you can sanitize, validate and authorize data, using code that you can control and secure. ...


2

I did something similar to an event sourcing system only recently. The domain needs to replay events in the correct order, but the domain model must not write an event to the store if another instance of the domain has just done so. I went with an optimistic concurrency approach. So the domain will retry its command and, if it is still valid, a new event ...


2

Honestly, I am having trouble parsing what you are saying. However, the problem is quite simple: if you allocate the same spare resources to both scalability and availability, then you cannot achieve both, you have to choose. allocate the spare resources for scaling, but then they are no longer available for failover, i.e. you can no longer guarantee ...


2

Two approaches come to mind. Cron allows specifying what amounts to an order of magnitude rather than a specific time. If you need these clients to hit an endpoint on a fixed interval, this may be an attractive solution. TCP handles collisions through exponential back off, which has the downside that it requires an irregular amount of time to complete. ...


2

Speaking very abstractly, connected component labeling is an example of closure of equivalence relations. In the beginning, we only know the equivalence relations for some pairs of pixels. Specifically, we only know the equivalence relation for pixels that are next to each other (adjacent). Each pixel has a color, which is a binary value (either 0 or 1). ...


2

You've broken availability. Computers are not omniscient. They can't "immediately determine their link to the US is broken." All they can determine is they are no longer receiving responses to their packets. This could be caused by the link being broken or it could be caused by the other datacenter being down. Congratulations, you've just marked your ...


2

I understand finance industry uses a system of "after-the-fact" checking and fixups to resolve errors. ie, you make each transaction on the individual systems independently (such that you know that each system is correct) and you write to a log the details of each transaction. These logs are then compared later, and if an error occurred in one, the other is ...


2

As I wrote in my comment: You have to distinguish between traffic within a datacenter and interactions of users across the internet with (one) or more of your datacenters, or as I tried to coin it »intradatacenter« vs. »interdatacenter«. The magic sauce for the internet comes from BGP. It is something like a word of mouth-protocol which routers speak. When ...


2

First some baseline realities of queues: Queues are a powerful tool but they also introduce complexity. The big thing you need to solve for is what happens if a message on a queue is not handled successfully. A naive implementation will read from the queue, commit (and delete the message) and then try to process. If an error occurs, the message is gone. ...


2

The most natural and concurrent way to handle this kind of model is to build inbound and outbound queues on both B and D and two inbound queues on A (and possibly an outbound queue on A depending how it uses its result). An easy way to ensure throttling is to set a maximum outbound queue length on B and C and for them to suspend if their outbound queue ...


2

Here's a partial, but more practical and likely applicable, answer. If follow-on processes only consider files via their metadata entries, then the file upload and the update to the metadata need not be atomic. This means you can't have a process that processes every file in the SFTP directory. It would instead need to fetch the list of files from the ...


2

How should the workers notify the processor about new data? Should I use a simple REST server (i.e. Apache Tomcat) or some Message Broker to deliver the data to some backend service? You can use HTTP (REST) calls for this and keep it simple. The question is how you know what the host is that you want to call. You could consider using something like Kafka. ...


2

The most straight forward approach is probably to distinguish verified emails from unverified emails within your model, and have a single actor responsible for verifying a given email address. (The simple versions are that you have one actor responsible for verifying all email addresses, or one actor responsible for verifying each email address.) That ...


Only top voted, non community-wiki answers of a minimum length are eligible