1 2 Previous Next 16 Replies Latest reply on Jan 4, 2016 8:52 AM by realgrouchy

    The host's capacity was exceeded, try again later.

    deninger

      I have been wrestling with this error on and off again for awhile. It wasn't until today that I figured out what I think is happening. I would like some feedback.

       

      I am running FileMaker Server typically with only 5 or so connections from users on FM 13. Because I previously ran FM 12 Server Advanced, I also have 25 Web / iOS connections, though I never actually have any of those connected (on the web or iOs, at least--see the discussion below).

       

      To trouble shoot this issue, I created a simple log script to be run on the server. It receives a parameter and creates a new record in a log table.

      Go to Layout ["Log" (log)]

      New Record / Request

      Set Field [Log::Message; Get (ScriptParemeter)]

      Go to Layout [original layout]

       

      I then created looping script that calls the log script on the server

       

      Set Variable [$i; Value 0]

      Set Variable [$interval; Value: 0.1] // will vary this from 0.001, 0.01 and 1 sec

      Set Variable [$max; Value; 10] // will vary this as 25 and 50

      Loop

      Perform Script on Server ["Log Event (Event)" ; Parameter "Looping with interval of " & $interval & " $i =" & $i]

      // Perform Script on Server [Wait for completion; "Log Event (Event)" ; Parameter "Looping with interval of " & $interval & " $i =" & $i] // to see if this makes a difference

      Set Variable [$i ; Value: $i + 1]

      Exit Loop If [$i > $max]

      End Loop

       

      The results:

       

      $interval $max WaitForComplete Notes

      1 sec 10 Yes 100% logged

      1 sec 25 Yes 100% logged

      1 sec 50 Yes 100% logged

      1 sec 10 No 100% logged

      1 sec 25 No 100% logged

      1 sec 50 No 100% logged

       

      0.1 sec 10 Yes 100% logged

      0.1 sec 25 Yes 100% logged

      0.1 sec 50 Yes 100% logged

      0.1 sec 10 No 100% logged

      0.1 sec 25 No 100% logged order of log lines creates not linear

      0.1 sec 50 No 100% logged order of log lines creates not linear

       

      0.01 sec 10 Yes 100% logged

      0.01 sec 25 Yes 100% logged

      0.01 sec 50 Yes 100% logged

      0.01 sec 10 No 100% logged

      0.01 sec 25 No 100% logged order of log lines creates not linear

      0.01 sec 50 No 90% logged order of log lines creates not linear with Host Capacity Exceeded multiple times

       

      DISCUSSION

       

      1) It appears that once you start to push many requests at a time to the server without waiting for completing, this error comes up

      2) It also may be a coincidence, but whenever I keep the number of requests below the number of Web connections availabe, no error is generated

      3) If I exceed the number of Web Connections, the errors start to crop up and the script on server request is refused, resulting in lost data

       

      HYPOTHESIS:

      It appears that each instance of "Run Script On Server" is actually running as a separate connection to FM Server. If I look at the Web Admin-Console, I see each script instance show up briefly as a connection under Activity. Because I am not exceeding the total number of connections of FileMaker Pro at any given time (even if each script instance was a FM Pro instance, I am still under the 250 the server is set to accept because I only ran the script 51 times), these connections appear to be counted against my WEB connections.

       

      So, if one does not have any web connections, does one get this error on each request to run a script on the server? I am curious if anyone (including those at FM) have any insight into this behaviour.

       

      Mike

        • 1. Re: The host's capacity was exceeded, try again later.
          wimdecorte

          deninger wrote:

           

          HYPOTHESIS:

          It appears that each instance of "Run Script On Server" is actually running as a separate connection to FM Server.

           

          What made you think it would not?

           

          There is an explicit setting in the FMS admin console to govern the max # of concurrent PSoS sessions.

          If you were thinking that a PSoS session would run in the same user session as the connected client then you were wrong.

           

          Each PSoS call is an extra load on the server.  Which is why i have and others have been pushing back gently on the notion that PSoS is the end-all-be-all cure to slow client performance.  Each PSoS session is the equivalent of a new client logging on to server but instead or running the scripts locally, it runs on the server.  If the server is not explicitely configured for that kind of load then things may be slower, not faster.

          • 2. Re: The host's capacity was exceeded, try again later.
            BruceHerbach

            Wim, Mike,

             

            Having sat through a couple of sessions on PSoS at Devcon,  I'm finding it very useful. You are correct that PSoS is a new connection to the server.   That stated, I think the question is where does FMS count the connection.  Mike's post title indicates that he is exceeding the number of available connections.  He has 250 Pro connections available and only 25 Web.  So why is he getting that error?

             

            The second part of his issue  is the records being out of order.  Here he  running the script with out waiting for completion is the issue.  He is getting into a race situation, with multiple process creating records in the table.  If he wants them in order,  then he needs the Wait for completion flag set.

             

            In most instances where I'm using PSoS,  I want the script to complete and usually return a result, before the calling script continues.  So in both cases,  I have the Wait for completion flag set.

            • 3. Re: The host's capacity was exceeded, try again later.
              deninger

              wimdecorte: I guess that I mislead you into thinking that I was surprised by the separate connection. I was/am not. I am just trying to figure out what type of connection it actually is making. I am completely aware of potential performance issues etc with this type of PSoS call. It is just that I was surprised that it is so easy to overwhelm the connection pool and the lack of an apparent waiting queue if FM receives a slew of requests in a short period of time.

               

              Taking a closer look at Admin Console for a PSoS setting, (I was not aware that such a beast existed), I see that the default is 25 simultaneous script sessions (a number that matchs my experimental results).

               

              I am still somewhat dissappointed in the overall design of PSoS. It appears that FM does not queue the script requests when it reaches the specified max sessions, but instead refuses them (leading to the user getting an error and the "data" being lost). I understand reasoning of "maximum simultaneous sessions" but not of the lack of a queue, allowing the data to eventually be processed as free script sessions are opened. I also did not find any logging of this "refused" state in the logs, so the only indication is the rather cryptic error message the end user gets.

               

              I also found it interesting (though not necessarily surprising) that each session of a PSoS appears to call the log-in script attached to the DB.

               

              Thanks

              • 4. Re: The host's capacity was exceeded, try again later.
                deninger

                Bruce

                  I am not worried about the order (I just noted that in my observations because it appears that the PSoS does not use FIFO logic). I expected this to occur when not waiting for the script to complete.

                 

                I wanted to simulate multiple users hitting the PSoS queue at the same time. An example might be an end of the day report that all employees kick off at 5 pm when they leave. With more than 25 employees hitting a longer running script by PSoS, some scripts will be refused and not run. It is this lack of a waiting queue for the PSoS process that is the real problem. Yes, I can increase the size of the max simultaneous script connections, but that would have a possible negative impact on server perofrmance.

                • 5. Re: The host's capacity was exceeded, try again later.
                  greglane

                  Hi Mike,

                   

                  While I can see the appeal of a server-side queue, I generally prefer the current behavior where the client-side script receives the error immediately and can handle the condition. The script could simply inform the user, try the server-side script again (perhaps in a loop with a timeout), or perform the server-side script actions locally on the client.

                   

                  There are a number of conditions where Perform Script on Server can return an error. As long as the client-side script is using Set Error Capture [On], the developer retains control and can provide appropriate options to users.

                   

                  Greg

                  • 6. Re: The host's capacity was exceeded, try again later.
                    wimdecorte

                    Bruce Herbach wrote:

                    Mike's post title indicates that he is exceeding the number of available connections.  He has 250 Pro connections available and only 25 Web.  So why is he getting that error?

                     

                     

                    Because the default # of max PSoS sessions is 25, it's under "Database Server" in the admin console.

                    • 7. Re: The host's capacity was exceeded, try again later.
                      BruceHerbach

                      Wim,

                       

                      Thanks.  Could be very helpful.

                      • 8. Re: The host's capacity was exceeded, try again later.
                        BruceHerbach

                        Mike,

                         

                        Each call to PSoS opens a new session,  meaning it opens the file.  I have been putting a check in the On Open script that exits the script after running anything nessasary for the PSoS script when being run on the server.   Use something like this in an if statement:

                         

                        IF [PatternCount ( "Server" ; Get ( ApplicationVersion ) ) > 0 ]

                        exit script

                        End IF

                         

                        You can return a value at the end of the PSoS script by using Exit[ $Value ] where $Value is anything you need.  You can use this with Get(ScriptResult) or turn on errorchecking and get( lasterror).

                         

                        FMS can't queue the scripts because it is treating them as seperate database connections from separate OS level connections.  In short the Multitasking/Multiprocessor environment is doing it's job.  If you want them in sequence,  then you have to have the FM script wait for completion.

                        • 9. Re: The host's capacity was exceeded, try again later.
                          deninger

                          Bruce:

                           

                          Yes, each PSoS opens a new session. It is not opeining a traditional session, however, but a PSoS specific session. If it were opening a traditional filemaker session, I would not see issues until the server had 250 users and scripts running simultaneously.

                           

                          FM created a separate setting for PSoS connections. Based on this alone, I would have expected some sort of queueing when the max number of simultaneous PSoS sessions (25 be default) is reached. Not doing so creates the above error AND data loss!

                           

                          Again, I understand the what and how, I just don't understand the why (on the part of FM).

                           

                          It is one thing to tell the end-user that there are not any connections to the server available when they try to connect. They will then call IT and we can take care if it. It is another thing entirely to give the end user this same message when a script (they did not create) is run. The end-user simply clicks OK and it appears to continue and finish. They may or may not call IT (because it appears to have worked) The results, though, are not complete or are completely wrong!

                           

                          I am not sure if there is a good way to capture this type of error. I will have to dig a little deeper...

                          • 10. Re: The host's capacity was exceeded, try again later.
                            jormond

                            Does this error generate a trappable error point. Where you can roll back when the error is encountered?

                            • 11. Re: The host's capacity was exceeded, try again later.
                              deninger

                              Funny you should ask. I just got around to testing this out.

                               

                              FileMaker throws an Error 812 (which is not listed in http://www.filemaker.com/help/html/error_codes.html but is probably related to host capacity).

                               

                              So I am now going to have to check for this EVERY time I run PSoS because I cannot predict when this one will bite me in the behind.

                               

                              I still think that the implementation could be improved. While it is not a bug, it is (to me) an annoyance...

                              • 12. Re: The host's capacity was exceeded, try again later.
                                BruceHerbach

                                I would think that set ErrorCapture on before the PSoS statement and Get(lasterror) directly after would do it.  In the case of wait for completion being off,  I suspect you would still capture the error.  You can then put up a custom dialog that the user would understand.

                                 

                                As far as number of Script connections goes, a PSoS script connection should have a very short life.  I have been using them primarily for two items so far.  The first is doing a set variable with ExecuteSQL.  Typlically this takes a few milliseconds.  The second is updating fields for a set of records.  Depending on the complexity, related tables and number of specific fields,  milliseconds to minutes.  In general even the long update scripts have a fairly short life. 

                                 

                                So unless you have a large number of users who will be executing PSoS scripts at the same time,  you will need only a small number of PSoS connections to the server.  If this is a concern,  then have the Admin up the number for the Maximum number of script sessions.

                                 

                                The exception to this are items like your test that execute PSoS scripts in a loop with out waiting for completion.  In this case,  conceivably you can hit the limit anytime you want. 

                                 

                                So far in all of the implementations I have done,  I have found it best to wait for completion. 

                                HTH

                                • 13. Re: The host's capacity was exceeded, try again later.
                                  wimdecorte

                                  deninger wrote:

                                   

                                  Funny you should ask. I just got around to testing this out.

                                   

                                  FileMaker throws an Error 812 (which is not listed in http://www.filemaker.com/help/html/error_codes.html but is probably related to host capacity).

                                   

                                   

                                  It is listed under the 13 error codes:

                                  http://www.filemaker.com/help/13/fmp/en/html/error_codes.html#1030072

                                   

                                  It is called "Exceeded the Host's capacity"

                                  • 14. Re: The host's capacity was exceeded, try again later.
                                    greglane

                                    deninger wrote:

                                     

                                    ...

                                    So I am now going to have to check for this EVERY time I run PSoS because I cannot predict when this one will bite me in the behind.

                                     

                                     

                                    PSoS is like a teenager...if you really care about what you asked it to do, you should verify that it actually happened. At least checking for errors with FileMaker script steps is easy and dependable.

                                     

                                    Greg

                                    1 2 Previous Next