logo

Concurrent Web Agents

Before I start, there's a new article for you. Nothing ground-breaking but a nice technique nonetheless.

Now, back to the normal program. Concurrent web agents. Remember I mentioned them last Thursday? Well, I've been asked an interesting question about them and I'm not sure of the answer.

What happens with global variables when we enable agents to run at the same time? Would one agent inherit values of variables with a similar name from another agent running at the same time? Does that make sense? I mean if two agents are running at the same time and both have a global variable called iCount, or something, would each have a distinct value?I find it hard to believe this wouldn't be the case, but nothing surprises me.

Also, feel free to go "off topic" and discuss why global variables are are a good/bad thing. I for one could do with a refresher on that topic...

Comments

  1. I certainly hope that the two agents would have separate Global variables. They are instantiated with separate Agent Manager executives. I will be very surprised if they share Global variables.

    • avatar
    • Jake
    • Tue 25 Jan 2005 05:22

    That's what I would have thought. Just wasn't sure enough about it to say I *knew* this was the case. Plus, it's too much hassle to try and test it. Much easier to pass it on to a winder audience...

  2. Global Variables are not shared, but there could be other problems with concurrent write access to the same document for example. For this LotusScript got a few more functions in R5 (CreateLock,DestroyLock,CodeLock,CodeUnlock,

    CodeLockCheck) to avoid this.

  3. Definately not shared!

    • avatar
    • Andy Burnett
    • Tue 25 Jan 2005 06:51

    I am at Lotusphere at the moment - so if anyone wants to 'ask the developers' I am very happy to take them your questions - I have a bunch to ask them myself.

    • avatar
    • Jake
    • Tue 25 Jan 2005 07:43

    Thanks guys. Why do I feel stupid for not knowing this kind of stuff already?

    • avatar
    • Debbie
    • Tue 25 Jan 2005 08:42

    Jake, you're just asking on behalf of those of us who really don't know and haven't had a reason to think about it yet ;)

    • avatar
    • Michael
    • Tue 25 Jan 2005 11:25

    Andy, ask the developers why they haven't put out a decent JDBC driver for Notes? (and not the ODBC bridge one that came out with version five.)

    I'm looking at Jasper reports (from sourceforge.net) and I'd love to use it with Notes. Cry$tal is too expensive and the alternatives are few.

    Sorry for the off-topic entry Jake. btw... What is everyone using for reporting out there?

  4. Michael, don't laugh but for our needs we find the most flexible reporting tool to be MS-Excel.

    • avatar
    • Michael
    • Tue 25 Jan 2005 12:33

    I looked at that option Tony along with the article Jake posted sometime ago. I'm just trying to see if there's another option out there. Currently I'm trying to use views --> RSS/RDF into Jasper as an XML file datasource. That way I wouldn't have to mess with every server setting up DSN's. Some products out there do not respect the response hierarchy and maintaining those relationships in the reporting is essential.

  5. I think you'll find that the most flexible reporting tool is actually going to be Stansoft Omnicrash 2005 SP7 (due out this year). The name is unfortunate, I realise that, but it pretty much describes what the product has done through most of its development cycle -- it will stop all processes except itself and the operating system, and makes an EXCELLENT alternative to ZapNotes, NotesMedic, and so forth. Every once in a while it will, almost by accident, create a wonderfully detailed report from user-selected criteria, complete with graphics and charts and stuff. It is available for both workstations and servers, and will take down either Notes or Domino, any version from R5.0.2c to ND7 Beta 2 (COM required). Once pricing has been determined, I'll let you know where you can get a copy.

    • avatar
    • Jake
    • Wed 26 Jan 2005 03:06

    Stan. From your description I can't see why I'd buy your software. What does it do that others don't already?

    I have a few questions I'd like to "ask the developers" but I think I'll keep them to myself.

  6. Did you not get it? It takes down ALL processes except itself and the OS -- most other commercial products will leave one or two stray processes running. My utility gets them all, AND leaves orphaned open connections on the servers when run from a workstation. Do you have any idea how much cleverness goes into a solution like that?

    When it fails in its primary goal and creates a report, it has one major advantage over everything else out there -- price. It'll be whatever OpenNTF.org normally charges for downloads. Oh, and it will (of course) be open source. It's essentially a version of a project that was in a fairly advanced state when it was cancelled (yes, a third-party shrinkwrapped product would have been cheaper than having someone like me write the same thing internally, and I did try to explain that before the project began, but ... well, I still don't quite get it, to tell the truth).

  7. Are we all really, really sure about the globals not being shared? I certainly would hope Notes gets this right BUT someone here has prevented concurrency being turned on on our web servers because of the following possibility: Because WEB agents are not run through Agent Manager - rather the HTTP task (Is this true?), the globals would need to be locked in order for multiple instances to run concurrently. And the point here is that its multiple WEB agents NOT scheduled NOTES agents. Is this an issue with the HTTP task, or is there no issue and concurrency on the web does not mean you have to start protecting your global objects (as you may do with other languages when using threads). Obviously this is quite an issue for us: one 'expert' opinion is currently crippling the performance of our large government website - I can't refute the guy as what he says is plausable. Worse, if its true and we switch on concurrency, the website would start going haywire.

  8. PS. to above: I appreciate concurrency in Notes scheduled agents is no issue and that globals are instanciated by each agent manager thread running an agent. The point is on the web, HTTP runs the show (or does it for agents?)

    • avatar
    • Jake
    • Wed 26 Jan 2005 16:30

    Gareth. Nobody seems 100% but I get the impression there are those who believe it's safe to turn on. Have you no way of testing it? Spare server anywhere?

  9. Plausible, yes, but incorrect. Yes, the HTTP task is the agent manager on the web. No, that does not mean that agent variables, global or local, collide. Think about it for a moment -- if the agents ran in the same space, then all variables would be shared across instances of the same agent. That little assumption can be easily tested by running two or more long-duration do-nothing agents that do little but write an identifier to a variable and later print the variable to the requestor. Heck, make it a global, just to be safe, and stick the user name into it. A sleep command can provide the duration. Run the agent from two browsers on two different workstations (or one in IE and one in Mozilla -- anything that will allow you to log in to the server differently), one a second or so after the other. See if the first request gets the second request's user name. (Won't happen.)

  10. Stan Rogers - are you pulling our leg re "Stansoft Omnicrash 2005 S" ? If not, I don't get it !!

  11. Good stuff guys - something concretely testable will prove concurrency isnt an issue. I think I'll put it to the guys at work they need to prove concurrency is an issue to justify leaving it switched off, thus justify impacting the web site performance.

  12. No, Omnicrash is real, but it won't actually be finished until it has demonstrated that it has earned the right to a new name. That is, it won't be foisted on the public until it creates reports far more often than it crashes.

  13. A little late into the conversation, but definately the global variables will not be shared across multiple instances of the same agent.

    • avatar
    • Susant
    • Thu 6 Sep 2007 07:53 AM

    Hi,

    I dont know if posting this query in the right forum but then I have got this problem which I need to solve ASAP. Whenever I try to run an agent simultaneously from multi users, it throws some kinda error and sometimes even crashes the server. Can anyone help me out ?

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 25 Jan 2005

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content