Comments (9)
Actually if you run this code right now:
ICluster clusterA = Cluster.newInstance().join();
It will start transport on default port 29001.
from scalecube-services.
Dynamically allocated means on nodes start on default port 29001 + 1
After enhancement it will be possible to run on same vm several cluster instances:
...
ICluster clusterA = Cluster.newInstance().join(); -- > starts on default port
ICluster clusterB = Cluster.newInstance().join(); ---> starts on default port +1
from scalecube-services.
We can do dynamically allocated ports, but there is one problem here.
Cluster creates transport instance in newInstance() method, but start in join() method.
This will cause situation when next code will not work as expected
for (int i = 0; i < 10; i++) {
clusters.add(Cluster.newInstance());
}
for (ICluster cluster : clusters) {
cluster.joinAwait();
}
I wonder why we really need to separate newInstance from join?
@antonkharenko @ronenhamias WDYT?
from scalecube-services.
IMHO there are 2 options:
Option 1 (base port)
ICluster clusterA = Cluster.newInstance(3000).join(); // start on port 3000
ICluster clusterB = Cluster.newInstance(3000).join(); // start on port 3001 since 3000 is taken.
Option 2 (port 0)
it means that these 2 lines are the same:
ICluster clusterA = Cluster.newInstance().join();
ICluster clusterA = Cluster.newInstance(0).join();
from scalecube-services.
Don't you think that this approach might lead to unpredictable behavior?
Zero configuration == good defaults, but it does not mean "find some random port just to do not fail".
What if some other application already uses this port (for example, old server instance that was not killed / stuck), and correct behavior in this case should be just fail to start?
from scalecube-services.
@kshchepanovskyi Basically idea is somewhat similar to what Hazelcast do (see http://docs.hazelcast.org/docs/3.3/manual/html/ports.html) that it doesn't find some random port, but search in the configured ports range (with meaningful defaults) for the free port to bind. If all ports from the configured range are bound then fail. Having only one port basically is just a special case of port range where this range contains single element.
from scalecube-services.
Ok, with "automatic cluster node discovery" - similar to Hazelcast's multicast/tcp - it might be good idea.
Anyway, there still are few tricky moments.
- Hazelcast always checks if service that listens on remote port is actually hazelcast.
- Hazelcast has a concept of "cluster name". Cluster nodes should check remote node's "cluster name" so that they are confident they do not connect to wrong node.
That's why I consider this feature danger.
Motivation: streamline testing and development and deployments with zero configuration.
If we do not handle all corner cases, instead of improving things we can make them only worse.
from scalecube-services.
@kshchepanovskyi Basically automatic node discovery is supported via seed members (it means you need to provide address of at least one existing node on cluster join to discover all other nodes in the cluster). It is not supported multicast discovery (as for now) since it I am not sure it has much value outside of demo or dev environment - multicast often disabled.
Also we have the concept of "cluster name" too. It is called "syncGroup" and it is a part of cluster configuration (ClusterConfiguration.ClusterMembershipSettings.syncGroup) which you can set to arbitrary string identifier. In addition to that Transport send handshake messages on connect so basically node on the other end need to run Transport too in order to pass handshake.
from scalecube-services.
Done at PR: #57
from scalecube-services.
Related Issues (20)
- Unstable test ServiceCallRemoteTest.test_many_stream_block_first()
- Investigate warnings due to java.nio.channels.ClosedChannelException from rsocket client HOT 3
- Reconsider/refactor/simplify code in .toResponse HOT 3
- Change error qualifer format HOT 4
- Create settings function for `headers` in ServiceCall HOT 1
- Refactor ServiceMethodInvoker.authenticate line 158 HOT 1
- Support qualifier format with version HOT 1
- Headers Naming Convention
- Why Service interface and qualifier has one-to-one relationship HOT 5
- NoSuchElementException from Microservices#discovery HOT 4
- Incorrect REQUEST_CHANNEL method
- Move ConnectionSetupCodec to scalecube-services-api
- Is there any up to date documentation anywhere? HOT 1
- Website expired? HOT 2
- Measure performance with java 17 + loom enabled HOT 1
- How to dynamically register services HOT 6
- Java 9+ Module Support HOT 1
- Add AutoCloseable on Microservices HOT 3
- kubernetes
- Dynamic service registration after Microservices instance is started
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalecube-services.