Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Admin API - is it thread safe?

Hi,

Is it safe to use org.openspaces.admin.internal.admin.DefaultAdmin (implementation of org.openspaces.admin.Admin) by multiple threads at the same time?

Thanks

asked 2017-09-13 10:17:58 -0600

mariuszb gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

Hi,

The Admin is not thread safe. If you have more than one Admin for a period of time that is fine but keeping 2 or more up is not a good practise. Why do you need more than one?

answered 2017-09-14 03:06:20 -0600

Yuval gravatar image
edit flag offensive delete link more

Comments

Mostly for grid startup. We have about one hundred processing units we need to deploy and doing it sequentially takes too much time. So if we want to do multiple deployments at the same time we need to guarantee synchronized access to Admin, right? Do you have any better suggestions?

mariuszb gravatar imagemariuszb ( 2017-09-14 03:35:50 -0600 )edit

This might cause the PUs to spread unbalanced on the cluster and don't think that will reduce the development time. In case you are using the gs command then moving even to one Admin might reduce the deployment time as the gs command contain some sleeps inside. In 12.2 we have added new algorithm fits to large cluster that reduce the deployment time by saving networking between the GSM and PUs

Yuval gravatar imageYuval ( 2017-09-14 04:13:38 -0600 )edit

@Yuval, deployment time is definitely smaller as more GSCs can be starting PUs at the same time. From our experience parallelization makes sense up to number of GSCs (4 GSCs -> 4 simultaneous deployments), if we use more we can see some provisioning errors in logs (but in the end everything gets deployed).

mariuszb gravatar imagemariuszb ( 2017-09-14 06:28:31 -0600 )edit

The provisioning errors might be related to that fact that the Admin is not thread safe.

Yuval gravatar imageYuval ( 2017-09-17 04:30:40 -0600 )edit

Thanks @Yuval

A bit more specific questions:

1) We're deploying GSCs in multiple threads in order to reduce platform startup time, following piece of code is executed:

admin.getGridServiceAgents().getHostNames().get(host).startGridServiceAndWait(gridServiceContainerOptions)

We didn't notice any issues or side effects of that. Is it safe for prod use?

2) If we want to deploy multiple PUs at the same time - will it be safer to use multiple AdminAPI instances or in general we should do it in single thread? Related code:

admin.getGridServiceManagers.deploy(processingUnitDeployment)
mariuszb gravatar imagemariuszb ( 2017-09-19 03:11:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-09-13 10:17:58 -0600

Seen: 216 times

Last updated: Sep 14