Management Server CPU load become high when our programs(20 process) trys
to get access token via VideoOS.Platform.SDK.Environment simultaneously.
Our program called “Login” only at first and called “Logout” at program end.
But after we modified our program to call “Login” and “Logout” everytime we get new access token, high CPU problem disappeared.
We’re suspect there’s a un-documented limitation about the number of concurrent connection.
Calling “Logout” frequently is the correct way to use VideoOS.Platform.SDK.Environment?
private void AccessTokenUpdate()
{
CredentialCache cred = null;
string url = null;
if (this.IsBasicAuth)
{
url = string.Format("https://{0}:{1}", this.Hostname, this.Port);
this.TargetUri = new Uri(url);
cred = Util.BuildCredentialCache(this.TargetUri, this.Username, this.Password, "Basic");
}
else
{
url = string.Format("http://{0}:{1}", this.Hostname, this.Port);
this.TargetUri = new Uri(url);
cred = Util.BuildCredentialCache(this.TargetUri, this.Username, this.Password, "Negotiate");
}
VideoOS.Platform.SDK.Environment.RemoveAllServers();
VideoOS.Platform.SDK.Environment.AddServer(this.TargetUri, cred);
VideoOS.Platform.SDK.Environment.Login(this.TargetUri, false);
VideoOS.Platform.SDK.Environment.LoadConfiguration(this.TargetUri);
LoginSettings ls = VideoOS.Platform.Login.LoginSettingsCache.GetLoginSettings(url);
this.Token = ls.Token;
// Management Server's CPU usage become high without following statements.
VideoOS.Platform.SDK.Environment.Logout(this.TargetUri);
VideoOS.Platform.SDK.Environment.RemoveServer(this.TargetUri);
}
When using the MIP .NET Library you do a login when you start your application, and never otherwise.
I think you have made an assumption that you need to login again and again to renew tokens, this is not a correct assumption, the MIP environment maintains the token automatically.
So the answer is to login once, not repeatedly.
Our program use MultiMedia Toolkit for image reading from recording server.
Access token is used for that purpose.
Original program did not call Logout, but Management Server’s CPU usage increased gradually after 45 min.
In short, our program was
* Login at program startup
* Didn’t Logout
* Management server CPU usage increased gradually after 45 min.
* And high CPU problem disappeared after we call Logout everytime.
Perhaps I misunderstand your code and where you use it.
I will just state that -
You can subscribe to LoginTokenChangedIndication, when you in that fashion get a new token you should do Updateconfiguration on the source toolkit (reference - http://doc.developer.milestonesys.com/html/index.html?base=mmtkhelp/tutorial.html#connecting_to_a_source&tree=tree_2.html)
Yes, What we’d like to do is token update for Multimedia Toolkit.
And No, the problem is not the token update method, but the token acquisition method.
In our environment, management server’s CPU become high when 20 process acquired separately without Logout method call.
I am saying that the token acquisition method cannot include a login. My suggestion is that you try to subscribe to LoginTokenChangedIndication.
We’ll modify our code to use LoginTokenChangedIndication.
But high CPU usage problem seems to be triggered by login from multiple program process, I suppose problem happens again after modification.
Login (in MIP .Net library) is a costly operation as all configuration is read, this is why any application should login at start up only. No application should be developed that will login frequently. The design is there so that configuration is cached and re-login is not needed.
We’re still investigating this issue.
Based on your advise, we modify our program as follows.
- Login at process startup, logout at process end
- Call Toolkit UpdateConfiguration when token updated by Login Settings TokenChangedEvent.
Our program use 1 process per 1 camera stream process.
So XProtect Management Server need to maintain login session for the number of processing camera stream.
In our environment, XProtect Management Server’s CPU load become 80 to 100% when we process 20 camera streams after program start.
Most of the CPU load comes from “IIS Worker Process w3wp.exe”.
If we modify our program to call logout after token update, CPU load become lower.
We’d like to double confirm “Is there a limitation about the number of concurrent connection in Toolkit”?
The Toolkit does not communicate with the Management Server so I must suspect that you do something else.