distributed-system

ZeroMQ with NORM - address already in use error was thrown on 2nd .bind() - why?

无人久伴 提交于 2021-02-20 02:13:34
问题 I'm using ZeroMQ with NACK-Oriented Reliable Multicast ( NORM ) norm:// protocol. The documentation contains only a Python code, so here is my C++ code: PUB Sender : string sendHost = "norm://2,127.0.0.1:5556";// <NormNodeId>,<addr:port> string tag = "MyTag"; string sentMessage = "HelloWorld"; string fullMessage = tag + sentMessage; zmq::context_t *context = new zmq::context_t( 20 ); zmq::socket_t publisher( *context, ZMQ_PUB ); zmq_connect( publisher, sendHost.c_str() ); zmq_send( publisher,

Name of “notification-and-check” pubsub architecture?

余生颓废 提交于 2021-02-17 03:28:26
问题 Basic pubsub architecture question. At a high level, when designing pubsub, I sometimes face a choice between two architectures: Publish mutations or "new-state". Some DB state is mutated, and publishers notify of that change via pubsub. But they include enough information in the message so that the subscriber doesn't need to do a look-up on the DB. Imagine the subscriber has a cache of the DB. It could receive the mutations or new-state, and update its cache without doing a look-up.

Java: properly closing sockets for multi threaded servers

血红的双手。 提交于 2021-02-16 18:06:33
问题 I'm trying to create a multi threaded server to which multiple clients can connect and can be served. However, I'm not sure on how to properly free up my resources should the need arise. My server runs an input thread (waiting for user inputs) and a procressing thread (handles connections and users). I open up a ServerSocket in the server class and pass it to my processing thread. It looks like this: public class ClientConnector implements Runnable { private ServerSocket serverSocket; public

Java: properly closing sockets for multi threaded servers

為{幸葍}努か 提交于 2021-02-16 18:06:33
问题 I'm trying to create a multi threaded server to which multiple clients can connect and can be served. However, I'm not sure on how to properly free up my resources should the need arise. My server runs an input thread (waiting for user inputs) and a procressing thread (handles connections and users). I open up a ServerSocket in the server class and pass it to my processing thread. It looks like this: public class ClientConnector implements Runnable { private ServerSocket serverSocket; public

Why is it legit to take the next two commands to fill gaps between paxos events?

落花浮王杯 提交于 2021-01-27 21:25:22
问题 There is a point in Paxos algorithm (http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf) that I do not understand. It's about how to deal with the gaps, the paper describe two ways as below: The leader, as well as any other server that learns all the commands the leader knows, can now execute commands 1–135. However, it can’t execute commands 138–140, which it also knows, because commands 136 and 137 have yet to be chosen. T he leader could take the next two commands

How to create ZeroMQ socket suitable both for sending and consuming?

浪尽此生 提交于 2021-01-01 09:21:28
问题 Could you please advice an ZeroMQ socket(s) architecture for the following scenario: 1) there is server listening on port 2) there are several clients connecting server simultaneously 3) server accept all connections from clients and provide bi-directional queue for each client, means both party (client N or server) can send or consume messages, i.e. both party can be INITIATOR of the communication and other party should have a callback to process the message. Should we create additional

How to create ZeroMQ socket suitable both for sending and consuming?

℡╲_俬逩灬. 提交于 2021-01-01 09:21:11
问题 Could you please advice an ZeroMQ socket(s) architecture for the following scenario: 1) there is server listening on port 2) there are several clients connecting server simultaneously 3) server accept all connections from clients and provide bi-directional queue for each client, means both party (client N or server) can send or consume messages, i.e. both party can be INITIATOR of the communication and other party should have a callback to process the message. Should we create additional

How to design a system that can manage configurations in a dynamic way efficiently?

我们两清 提交于 2020-08-10 19:34:30
问题 I am working on designing a system where I need to manage configuration (config files) in a dynamic way across bunch of application servers. I am working with Consul key value store to manage configurations. I created below node in consul kv store for the purpose of managing configurations. {"remoteConfig":"abc-123.tgz", "...."} Here remoteConfig contains the config file that all the app servers will use (atleast this is the design I got). Below is what I am trying to do: All the app servers

Load balancer and API Gateway confusion

为君一笑 提交于 2020-07-09 12:48:05
问题 I have always worked on mobile technologies and now I am stepping into backend systems, more specifically systems design. I keep coming across conflicting statements for the roles of api gateway and load balancer. Googling has only returned the same half a dozen results that mostly focus on the implementations of load balancer or api gateway service provided by some famous service. I will list here all the confusing I am facing, in hope someone can clarify all of them. Sometimes, i come

how raft follower rejoin after network disconnected?

谁说我不能喝 提交于 2020-07-08 19:46:17
问题 I have a problem on raft. In paper "In Search of an Understandable Consensus Algorithm(Extended Version)" it says: To begin an election, a follower increments its current term and transitions to candidate state. (in section 5.2) and it also says: reciever should be "Reply false if args.term < currentTerm" in AppendEntries RPC and RequestVot RPC so, let's think this scene, there are 5 machine in raft system, and now machine 0 is leader, machine 1 to 4 is follower, now is term 1. Suddenly,