Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

You can scale CDAP components (instances of services and workers) using:

  • the Scaling methods of the Lifecycle Microservices;

  • the Get/Set Commands of the Command Line Interface; or

  • the ProgramClient API of the Java Client API.

The examples given below use the Lifecycle Microservices.

Scaling Services

You can query or change the number of instances of a service by using the instances parameter with HTTP GET or PUT methods:

GET /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/instances
PUT /v3/namespaces/<namespace-id>/apps/<app-id>/services/<service-id>/instances

with the arguments as a JSON string in the body:

{ "instances" : <quantity> }

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application

service-id

Name of the service

quantity

Number of instances to be used

Note: You can scale system services using the Monitor Microservices Scaling System Services.

Examples

  • Retrieve the number of instances of the service CatalogLookup in the application PurchaseHistory in the namespace default:

    GET /v3/namespaces/default/apps/PurchaseHistory/services/CatalogLookup/instances
  • Set the number of handler instances of the service RetrieveCounts of the application WordCount:

    PUT /v3/namespaces/default/apps/WordCount/services/RetrieveCounts/instances

    with the arguments as a JSON string in the body:

    { "instances" : 2 }
  • Using curl and the CDAP Sandbox:

 Linux
$ curl -w"\n" -X PUT "http://localhost:11015/v3/namespaces/default/apps/WordCount/services/RetrieveCounts/instances" \ -d '{ "instances" : 2 }'
 Windows
> curl -X PUT "http://localhost:11015/v3/namespaces/default/apps/WordCount/services/RetrieveCounts/instances" ^ -d "{ \"instances\" : 2 }"

Scaling Workers

You can query or change the number of instances of a worker by using the instances parameter with HTTP GET or PUT methods:

GET /v3/namespaces/<namespace-id>/apps/<app-id>/workers/<worker-id>/instances
PUT /v3/namespaces/<namespace-id>/apps/<app-id>/workers/<worker-id>/instances

with the arguments as a JSON string in the body:

{ "instances" : <quantity> }

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application

worker-id

Name of the worker

quantity

Number of instances to be used

Example

Retrieve the number of instances of the worker DataWorker in the application DemoApp in the namespace default:

GET /v3/namespaces/default/apps/DemoApp/workers/DataWorker/instances

  • No labels