Anna Golitsyna · Nov 11, 2020

Running code on another machine

Hi everybody,

Is there a way to run code on another machine? Of course, all authentication info is known. I know only about RemoteResultSet but that seems to be query specific.

Thanks in advance,
P.S. The ultimate goal, in case that matters, is to create identical globals on 2 different machines with one run.

3 1 22 245


I'll look up applications under the first and the third link, thanks. The middle one is specific to IRIS, just checked, and I have Cache. I was more hoping for a short set of commands but if that is not available, oh well.

I didn't mention SOAP WebServices that you can generate directly in Studio.

I looked up your single class under your third link and it's probably a total newbie question but I don't see where would you specify login info for the remote server.

Hello @Anna Golitsyna!
the 3rd example is 1 class that contains 2 basic functionalities:  A Server and a Client.
The system you want to control runs the ClassMethod Server.
- opens an IP port and listens for orders, execute it, and continue looping.
- it is typically started in the background during  system start (from %ZSTART.mac)
This is the "hidden Login"

The (Classmethod) Client connects to the listening port and sends a request and gets answers.
The structure of Requests and Answer is up to you and makes sure you have always control
over what should happen on the remote system. As your  "Listener" is active already there
is no need for any further login. But you are of course free to implement it on top of this basic mechanic.


You could try creating a web application on the other machine and then using a REST HTTP method to call the code to execute and return a data packet back as a %response object.  This would be similar to calling a method from an Angular UI to you server, but can be accomplished using %HTTP Requests from server A to server B as well.

Mirroring is about creating identical globals on multiple machines with one update.  I assume you don't want these systems exactly the same, but depending on what you do want, maybe you could find a configuration which would do it.  For example, maybe you could put the global you want replicated in its own database on an async member and not mirror any other databases.

Async mirrors are commonly used for reporting and other purposes.   What do you want to scale down to use it here?   

@Katherine Reid My goal is to update two globals on two different machines at the same time. That needs to be done from time to time only. Would or could "other async mirrors purposes" include that? If so is there any technical reading or specific classes, or the namespace setup, related to async mirroring that you would recommend to use for such a job? For example, this 101 guide, , specifically states "Deploying a Caché mirror does, however, require significant planning, and involves a number of different procedures. And like any other critical infrastructure component, the operating mirror needs ongoing monitoring and maintenance." Given that I simply need to keep two globals in sync the Export/Import process seems much faster that what is described by this mirroring quote. 

More importantly, as I just found out, "mirroring is unavailable for the current license"

Hi. If all you need is to set global nodes on a remote instance, then you could just set it up as a remote database and namespace and use Extended Global References to access it. No need to run code on the remote system. Or have I missed something?

It might be a hard exercise to manage write access from a local and a remote instance to a common DB at the same time.

 "mirroring is unavailable for the current license" 

It seems that they have a single server license, so ECP is probably not an option as well.
Otherwise, it's difficult to imagine the scenario when ECP remote (single!) database would not be better than duplicating the data in two databases. Just two cases come to mind:

  • slow internet connection
  • need to dedicate a whole server for some heavy data processing.

Anna, if you tell us more about your task, we'd likely advise you better.

It all sounds like a software provider in maintenance for its customers.
But then, I would connect with Studio (or similar), place my code and run it from the embedded terminal.

It all sounds like a software provider in maintenance for its customers.

In such a case it is usually easier to map that global from the separated database and distribute its updated copy among the customers.

A few people have suggested using web services, which seems like the most straightforward approach to me. Anna, is there a reason not to use a web service?

Marc, I'll consider going the Web Service way, but I am not a total but still a beginner in Cache. I never used Web Services before so I would need to learn that. I wish there would something as straightforward as the RemoteResultSet queries which take just a few short and obvious lines of code, no learning curve.

@Alexey Maslov The ultimate goal is to create identical globals on 2 different machines with a single run, on demand.  I can run code on the first machine, then export global creating code which changes regularly, reconnect the Studio to a different machine, import code, then run it again. This is decidedly not a single run. I can also export and import global too, of course. I am willing to learn functionality that would be faster to deploy than these two approaches. Ideally as fast as ZN which unfortunately works on the same machine only but I might be wrong about that.