Code Monkey home page Code Monkey logo

Comments (2)

bronsh avatar bronsh commented on September 2, 2024

Unfortunately, the documentation about discovery is not ready yet.

In short, there are two ways we support for calling Consul.

The first one is using Consul Queries - it executes a Consul query which its name is a combination of the service name and environment (for example: "GpuService-dev").
It is using the following api: {ConsulAddress}/v1/query/{ServiceName-env}/execute?dc={DataCenter}
It calls it every second (by default), to follow up changes.
This way is the default one, but it is going to be deprecated in the future.

The second way is making use of two Consul apis: key-value and health.
It first searches for this service at key-value store, calling this api:
{ConsulAddress}/v1/kv/service?dc={DataCenter}&keys
searching for a key named "service/{ServiceName-env}"
Then it calls this api:
{ConsulAddress}/v1/health/service/{ServiceName-env}?dc={DataCenter}&passing
In the service's tags, it searches for a tag starting with "version:", which states what is the current service version (The service may be deployed on more than one node, and it may contain different version on different nodes). Only nodes which have a version tag with the relevant version will be returned.
The call to these apis on done by long-polling, so it gets notification when changes occured, with no need to call it every second in order to follow up changes.
This way is better for performance issues, although it is more complicated for implementation.

You can configure how to use Consul by defining the following configuration entry: Consul.LongPolling
Its default value is "false", which means using the first way. Changing it to "true" will make it use the second way.
For more information about configuration, see here: https://github.com/gigya/microdot/wiki/Configuration-Repository

from microdot.

Allon-Guralnek avatar Allon-Guralnek commented on September 2, 2024

The issue in the samples was fixed by the following pull request:

gigya/microdot-samples#5

But it was merged into the branch 1_Basic_Gpu_Service. Try pulling that branch.

from microdot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.