Skip to content

optimize scalecube - serverLifePeriodMS option #200

Closed
@katzIdo

Description

@katzIdo

General description

every microservice container can act as a seed for another microservice container in our distributed env.

it results in inflation of unnecessary listeners which are added to the project.

every microservice that acts as a seed creates a "server-side" logic which means using a global listener that checks if it's been called.

my suggestion is to add to microservice API another property which called "serverLifePeriodMS: number"

if (serverLifePeriodMS === undefined) {
  // server listener will live forever
} else {
  // server will stop listen after  serverLifePeriodMS is done
}

this option is good when we creating an empty microservice that is used only to get proxies of other microservice containers, we can pass serverLifePeriodMS = 0.

or if we are running on the browser and we know that our services will load after x period of time, then we can set our serverLifePeriodMS to be 2*x.

this option is valid for the browser because it is unusual for service to be "destroyed" in the browser.

this is another reason why cluster-browser does not implement a "keep-alive" check.

API

Design proposition

A clear and concise description of the design proposition.

  • Is backward compatible

  • Adds new API

Pull Request

[Link]

New API

Code snippet

export interface MicroserviceOptions {
  // ... all previus methods unchanged
 serverLifePeriodMS : number
}

Ready for implementation

  • External dependencies have been resolved

  • API has been approved

  • Test cases have been prepared

  • Discussed with Technical lead

Definition of Done

  • Developer review

  • QA review

  • All tests are implemented

  • Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions