4 Replies Latest reply on Sep 11, 2016 12:29 PM by wimdecorte

    FINDS and RELATED RECORDS using PSoS

    RussW

      Not sure my title makes any sense, sorry for that, but I guess that's also a statement of how confused I am.

       

      I am in the process of optimizing my solutions to make maximum use of PSoS when appropriate.

       

      I have read that doing a FIND on the sever side is much faster. But once I find that record and throw it up on a local layout which has one or more portals to other tables, am I losing all the gains I made doing the FIND on the server side? If the relationships to the records from the various tables all have to have the full tables of each of those portals downloaded to my local machine to find just the related records, it seems to me that doing the FIND fast is an insignificant improvement. Or, does FMP know to retrieve and transfer over the WAN only the related records and not all of the rest?

        • 1. Re: FINDS and RELATED RECORDS using PSoS
          philmodjunk

          In many cases a find needs to be performed for one reason or another, but the results need not be displayed back to the client and thus this is not an issue in such case. And in other cases, a find might need to specify criteria in fields that, due to indexing limitations aren't "fast" when the find is performed. But once the found set is produced, the primary keys can be returned back to the client and the GTRR action you might use to pull up your found set might be much faster than the original find.

           

          But I wouldn't just assume that this is faster, I'd run some tests and see as there are a lot of factors here that can affect which method is truly the most efficient. Keep in mind that a lot of asynchronously executing PSOS's can slow your entire server down as well.

          • 2. Re: FINDS and RELATED RECORDS using PSoS
            wimdecorte

            RussW wrote:

            I am in the process of optimizing my solutions to make maximum use of PSoS when appropriate.

             

             

            As a general note: this comes at a price as I'm sure you realize (but I want to repeat it here):

             

            - first and foremost you are turning your database server into an application server, a server that has to actively spawn and execute virtual client sessions.  The server needs to be up to that task in its allocated resources.  Keep that in mind for the current requirements but also for any additional functionality or # of users you expect to add to the solution.

             

            - FMS has a set maximum # PSoS sessions available: you need to make sure to test / error trap & handle to see if any sessions are available before you throw something at the server

             

            - in case there are none, or the FMS script engine crashed: your scripts need to decide to loop-and-wait or turn around and execute the functionality locally

            1 of 1 people found this helpful
            • 3. Re: FINDS and RELATED RECORDS using PSoS
              RussW

              Thanks for the answers.

               

              I am not really concerned about overloading the severs because I am limiting my server side processing to things that would otherwise get bogged down by data transfer over the WAN. Besides, I am on a shared server so I have little control over that issue other than minimizing my own use of it. I'm just getting started and already have one table with 6000 records which, when run from my local workstation, take 90+ seconds to transfer before the find is executed. On the sever it's instantaneous.

               

              I can do some things to speed up data transfer rates, but not without creating data redundancy which is something I avoid at all costs. Even then, the transfer of 6000 records is a time suck. And those 6000 are soon to be many more thousands as the system gets used.

               

              I did not know about the resource limit on the use of PSoS. Good to know and I'll watch for that, especially as I am using a shared server. But how do I test for available resources and then, say I get a positive response, how do I keep someone else from grabbing it before I can make the call?

               

              The hosting service I use brags about their reliability and specifically how they monitor services to be restarted automatically should one shut down for any reason. And the reviews they get are all excellent. So far no issues on my end and they are quick to respond to any questions I've had. They're really good (now hoping I haven't jinxed myself). Still, how would I check to find out if a service is down so I don't end up with a system crash or a corrupted database?

              • 4. Re: FINDS and RELATED RECORDS using PSoS
                wimdecorte

                RussW wrote:

                 

                 

                I did not know about the resource limit on the use of PSoS. Good to know and I'll watch for that, especially as I am using a shared server. But how do I test for available resources and then, say I get a positive response, how do I keep someone else from grabbing it before I can make the call?

                 

                If the server is out of sessions or the script engine does not work then FMP will throw an error on the PSoS call (error 812 I believe).  So you have to trap for that every time you do an PSoS and then let business logic take over:

                - do you stop (is the data in a good enough state for that?)

                - do you loop and wait (how long? and what if if exceed the max time you want to wait)

                - do you let the client handle it?