question

daniela.z avatar image
1 Like"
daniela.z asked Ben Wilson commented

webserver number of running instances

We are having issues starting more than 5 model instances, causing the API to return the fail message:

The FlexSim webserver stops responding from that point on. Currently the way we solve this issue is by re-starting the server, all instances go away and the site comes backup. In the webserver configuration file we changed the number of “Max Instances of Flexsim” to 20 from the default 8, but we are still having the same issue.

Are there any other configuration settings that we need to change?

FlexSim 16.0.1
webserverapiserverconfigurationinstance
image001.png (10.8 KiB)
· 6
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

Can you open more than 5 instances of FlexSim with the model you are trying to open regularly (without using the webserver)? Can your hardware support opening that many FlexSim instances with that model open? Do you have enough RAM?

1 Like 1 ·
daniela.z avatar image daniela.z Phil BoBo ♦♦ commented ·

Yes, we can run more than 5 instances using the desktop app but not using the webserver. We updated our hardware to handle several instances so that shouldn't be a problem.

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ daniela.z commented ·

I wonder if the server overhead diminishes what the server is capable of.

Question: can you launch more than 5 instances if you do not connect to them?

1 Like 1 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

I'm surprised you would need to restart the entire machine. If you have desktop access to that server, can you check if it is the entire operating system frozen, or is it just the server software (IIS or Apache) that is frozen?

If the latter, you should only need to restart the server software, not the whole computer.

Perhaps it is not the server software, but some aspect of FlexSim that is crashed? Not sure how that would work from the server itself since it is just a DLL that that your server software attaches to. What about the individual FlexSim instances running - are they the thing that freezes?

I guess this whole comment boils down to: What exactly is freezing/crashing/not responding? Could you be more specific about the failure situation?

1 Like 1 ·
daniela.z avatar image daniela.z Ben Wilson ♦♦ commented ·

The situation is that after starting 5-6 instances the Flexsim webserver will not create any more instances and returns the message: capture.png

At that point I have to terminate all instances to be able to start new ones.

0 Likes 0 ·
capture.png (11.3 KiB)
victoria.davila avatar image victoria.davila commented ·

So to provide some clarification on the issue:

The FlexSim webserver is unable to create a new instance after creating 5 instances (error occurred on 5/31). Today on 6/1 the webserver was unable to create a new instance after successfully creating 4 instances. The instances successfully started are still running despite the error. In order to start a new instance we have to terminate one that is currently running. Currently we are not restarting the server or machine itself to restart new instances, only terminating ones that are already running. In the webserver configuration file we changed the number of “Max Instances of Flexsim” to 20 from the default 8, but we are still having the same issue. It appears the FlexSim webserver itself is not responding.

2016-06-01-11-27-52.jpg

0 Likes 0 ·

1 Answer

Ben Wilson avatar image
3 Likes"
Ben Wilson answered Ben Wilson commented

There is a Windows Registry setting that limits the amount of memory (desktop heap size) that Windows will allocate for non-interactive processes. Here is the registry path:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

This key has a value that is a long string with more key/value pairs:

%SystemRoot%\system32\csrss.exe
ObjectDirectory=\Windows
SharedSection=1024,20480,512
Windows=On
SubSystemType=Windows
ServerDll=basesrv,1
ServerDll=winsrv:UserServerDllInitialization,3
ServerDll=sxssrv,4
ProfileControl=Off
MaxRequestThreads=16

The SharedSection key defines, in its 3rd "parameter", the memory quantity we're talking about. By default it may be 512 or 768 (512 in the example above). You need to increase this beyond the total amount of memory that all your instances will use simultaneously.

In my testing, I increased the size to 1536. When doing so, I was able to launch more instances, until the total memory usage of my instances was 1125. Then I increased the registry to 4096, and was able to launch 3030 worth of FlexSim instances. Finally I increased the memory to 8196 and was able to hit all 20 instances allowed by the configuration file.

Keep in mind this was just my sample model, your model may require more memory. Also, I wasn't running my instances. If they were running, they would take more memory.

In my testing, FlexSim was able to use up about 70-75% of the desktop heap size memory that I specified in the registry. The rest is still used by Windows or other processes, so do plan on some overhead not associated with FlexSim.

This Microsoft article describes what is going on. In particular, search the article for 'SharedSection' for more information.

After changing the 3rd part of SharedSection, you will need to reboot for the change to take effect.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

We will update the webserver documentation in the User Manual to mention this, so that anyone setting up a webserver in the future will know this from the start.

1 Like 1 ·