Balancing User Load Over Multiple Service Tier Services

matttraxmatttrax Member Posts: 2,309
edited 2011-03-15 in NAV Three Tier
I think I asked this a couple of years ago when NAV 2009 first came out, but I can't seem to find the post and am wondering if anything has changed or if anyone has a solution.

We have 90+ user environment. We don't want to have to maintain a list of who is supposed to connect to which service on the middle tier. We would like every user to connect to a single service, and have that service decide which of the multiple NAV services it should use based on the current load of each. That way we don't have 50 users on one service and 2 on another. Ideally if one of the services was down there would also be some sort of notification.

Does anyone have a solution for this? Or am I stuck trying to build my own in C#?

Comments

  • ara3nara3n Member Posts: 9,256
    I have not heard of a solution, but there a couple of ways you can do it.

    One is to create your own C # that checks some table and who is logged in to what service and then changes the local xml settings and then opens NAV. NAV would then connect to that service. You would still have to write some code in NAV to populate a table with service ID/Name.

    The other option is to put to links on the desktop. And in CU check how many ppl are logged in and if there are too many error out that please select the second link.


    The other option is if you have multiple citrix, then let citrix do the load balancing and each citrix is connected to on service tier. If you don't have citrix, then this would be probably the most expensive option.
    I don't know if RDP has load balancing.


    I had suggest to MS to have in ClientUserSettings.config have a list of Servers with Max number of users. So the client would disconnect if the server has reached the max and connect to the second server. The right solution is probably more complex and using No. of Users is not sufficient.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • matttraxmatttrax Member Posts: 2,309
    ara3n wrote:
    One is to create your own C # that checks some table and who is logged in to what service

    Is there a system variable or function you can call to determine which service is being connected to? I see in the Session table it only lists the server name. I'd rather maintain all of the services on a single server if possible.
  • ara3nara3n Member Posts: 9,256
    No, there is no system table.
    You have to create your own table and On OpenCompany write record into the table.

    I have posted in here code, but can't find it on how to find which database you are connected on service tier.

    The same code can be used to find in the config file which service tier you are connected.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • matttraxmatttrax Member Posts: 2,309
    Good to know. I've started work on a C# solution. If it works well I will post it to the downloads section. Thanks for your help.
  • deV.chdeV.ch Member Posts: 543
    I made some thoughts about this and i would go for a c# application, in NAV should make a new table where you log the user and on which table he currently is. Then you make a Webservice with a function which returns the Server:PortNumber to a NST which as open slots. This will be called from the C# app on start and then you run your nav client with the parameter: [url=DynamicsNAV://]DynamicsNAV://[/url]<server:port>/<instance>/<Company>/
    instance , Company & a "Base" NST (For the Webservice Call) must be specified in the app config and a shortcut for your application is needed. That would be a neat and userfriendly solution with limited amount of modification.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    matttrax wrote:
    Good to know. I've started work on a C# solution. If it works well I will post it to the downloads section. Thanks for your help.

    =D>

    I think this is such a fundamental, that its odd it was not a part of 2009 since they introduced the service tier.
    David Singleton
  • matttraxmatttrax Member Posts: 2,309
    Don't know if anyone is following this, but I thought I would give an update. I have pretty much finished the solution, but need to document it and wrap it all up in a nice installer...and of course test it out more in a real environment. I'd love to get some feedback before I put it out there.

    It's a two part solution, one on the client side and one on the server side.

    The server side should be able to be installed anywhere and uses a config file similar to the NAV Service config file to determine which servers it should monitor. It connects to those servers and automatically finds any NAV Service Tier services that have been installed and loads them into a table in NAV. It monitors those services and periodically updates their statuses in NAV (Running, Stopped, Disabled, etc).

    The client side is just a wrapper for the RoleTailored Client executable. It uses a Codeunit published as a web service to determine the best service to connect to. I've added a new Key/Value pair to the user's config file to point to the web service they should use for this.

    Each service can have a maximum number of users set in the NAV table. You can also "force" a user onto a specific service, but they will only connect to it if it is available and not over it's set amount of users. It then overwrites the user's configuration file and launches the NAV executables. During login I record which service they are connected through in a second custom table that is linked to the Session table.

    Like I said, I still have to wrap it up in an installer and I also want to add an interface for administration. If anyone has any thoughts on things that would be useful feel free to reply here. Look for it in the next couple of weeks.
  • fragopfragop Member Posts: 1
    Can you please upload your development work/script, even the code itself so we I can try it in a development environment?

    Thank you in advance.
  • matttraxmatttrax Member Posts: 2,309
    fragop wrote:
    Can you please upload your development work/script, even the code itself so we I can try it in a development environment?

    I have submitted the file and it should be available soon. I say it in multiple places, but it might as well be an Alpha release, meaning there are still a lot of bugs. Use it at your own risk. I'm hoping to turn it into a community project as described in the Readme.pdf file.
  • deV.chdeV.ch Member Posts: 543
    sounds pretty much the same that i did (not in productional use either), except i don't have a server app that collects all active service tiers. i only use a client starter that comunicates with nav through webservice.
    Can you explain how you catch all installed service tiers? do you catch just the installed services on the machine that runs that server app or do you somehow scan for it on the whole network?
  • matttraxmatttrax Member Posts: 2,309
    deV.ch wrote:
    sounds pretty much the same that i did (not in productional use either), except i don't have a server app that collects all active service tiers. i only use a client starter that comunicates with nav through webservice.
    Yeah, it's nothing fancy. But hopefully I have built it so that others can extend it.
    deV.ch wrote:
    Can you explain how you catch all installed service tiers? do you catch just the installed services on the machine that runs that server app or do you somehow scan for it on the whole network?
    I don't think that part is in the download, yet. Essentially, though, there is a Windows Service that loads a configuration file, just like the standard NAV Services run. This config file has the names of all of the servers you want to monitor.

    From there you are able to read all of the services running / installed on those machines. Once you determine which ones are the NAV Services you can load the information from their configuration files. You can find the path to these files from the registry.

    At that point you have all of the information you need to insert records into the custom services table. The idea behind doing it this way was that the service would double as a monitoring service and automatically "turn off" any services that went down unexpectedly. There are lot of other nice things it could do like turn on extra services during peak load times or turn on another service when one goes down. I think if this part was built up and combined with one of the other tools out there it would really nice.
  • deV.chdeV.ch Member Posts: 543
    Sounds great :thumbsup: :)
Sign In or Register to comment.