no server available

Posted by Admin on 16-Apr-2008 16:02

with app server by default we have 5 agent available. my program make some calcul for a long time about 20 minutes by threat and when a have more that 5 user the we have message saying the "server is busy". i want to know is there is a way to test if there is a available agent to reponse at a proxy call.

All Replies

Posted by Admin on 16-Apr-2008 19:48

Not that I know of ... but you could start the proxy call on a worker thread and check for an elapsed period of time. If it takes longer than the user is prepared to wait you could then cancel the call/thread.

OR

Reserve the 5th agent for checking if four agents are already in use.

For example have the appservice process check a connection count, if the count has exceeded 4 (or what ever number) return immeadiately (with an error/warning?) rather than start the long 20 minute calculation.

Posted by Admin on 16-Apr-2008 19:52

...

or

change the appserver task to place the request into a queue and have a background (or set of background) processes which poll this queue and complete the long calculation.

Rather than "do the work" the appserver process logs the request and returns a "queue #" ... the client app can then use this "queue #" to check on the status of the request through short lived requests - if the job is complete return the results.

Posted by Admin on 16-Apr-2008 23:17

Are you talking about .NET proxies?

There are some static properties in the Progress.Open4GL.RunTimeProperties class/namespace. Please try properties like SocketTimeout, TcpClientRetry and TcpClientRetryInverval to change the time a client waits to get an available agent.

The rest is "just" a clever try/catch structure.

Posted by Admin on 17-Apr-2008 09:27

its for .net proxie

Posted by Admin on 17-Apr-2008 09:53

i like the idea to reserve a agent to check available number but do you know how I can check available agent and how to reserve one to do this.

Posted by Admin on 18-Apr-2008 08:17

i have already try some of this and it dont work as i want

Posted by Admin on 19-Apr-2008 06:24

You could look at creating your own database table holding a row for each of your 4 (or which ever # you need == max agents - 1). Have your session connect procedure initially attempt to exclusive lock one of these rows ... if none available then return appropiate status. If the session is able to lock then downgrade to a shared lock (so that you dont leave a transacion open - not sure if that is an issue in your current case, but may be in later uses of the same concept).

Disconnect procedure deletes the buffer holding the share-lock row.

You could use connect/disconnect procedures to manage an internal count (held on db record for example). Problem here though is if your session crashes you will need to reset the "session count". The advanage of using a locked row per agent is that is the agent dies for any unknown reason the lock will automatically be released.

Have not looked myself but you may be able to use the VST entries in the same way, by checking agent connections - however the agent stays connected to the database so an active connection only equals database connection - not the busy/waiting state of the agent.

What would be great is to find an api like the one used by asbman which reveals the state of the agents ... not sure if some PSC person would be willing to jump in at this point. I assume if works via a socket connection to the name/agent server but I have not seen this published anywhere

This thread is closed