1 2 Previous Next 27 Replies Latest reply on Apr 2, 2015 4:54 AM by Mike_Mitchell

    PSoS results

    siplus

      I need to create a new record in a database and get its uuid without disturbing what's on the screen.

       

      1) PSOS Method

       

      script: PSOS_NewAppointment

       

      Go to Layout [“AppointmentData” (AppointmentData)]

      New Record/Request

      Exit Script [Result: AppointmentData::UUID]

       

      Called with

       

        Perform Script on Server [Wait for completion; “PSOS_NewAppointment”]

        Set Field [Agenda::gPopOver_UUIDKey; Get ( ScriptResult )]

       

       

      2)  New window method:

       

      New Window [Name: "AppCreation"; Height: 100; Width: 100; Top: -1000; Left: -1000; Style: Document]

      Go to Layout [“AppointmentData” (AppointmentData)]

      New Record/Request

      Set Field [Agenda::gPopOver_UUIDKey; AppointmentData::UUID]

      Close Window [Name: "AppCreation"]

       

      3) Results:

       

      Method 1: 405 ms

      Method 2: 172 ms

       

       

      Method 1 without wait for completion: 3 ms, but you don't get the UUID back ...

      It seems that the performance of sending back the result of a PSoS script could be improved.

       

      Suggestions ?

        • 1. Re: PSoS results
          BruceHerbach

          I'm not sure about this,  but a single create record script step is probably not a good test of PSoS.  I have used it with good results when a large data set had to be processed.  An example would be running a ExecuteSQL statement looking for a specific product against the entire product table.

           

          Here the advantage is that the server does the ExecuteSQL against the local data.  Run the same ExecuteSQL statement in a Perform Script and all the data has to be downloaded to the client before the ExecuteSQL step can complete.  With PSoS it is done on the server so only the result is sent down the wire.  The data set is loaded through the servers disk I/O system.  A much faster interface.

           

          It is this scenario where you see a big performance improvement.

           

          HTH

          • 2. Re: PSoS results
            electon

            Isn't creating a new record via a relationship not a better option?

            That is a TO to the AppCreation related to let's say a global field in the current table. There's no need for a layout for this TO.

            Are you familiar with this design pattern? Otherwise I can explain more.

            • 3. Re: PSoS results
              Mike_Mitchell

              The reason the PSoS is slow in this case is because it has to start a completely new user session, including all the startup stuff (start session on server, OnFirstWindowOpen trigger, if present, etc.). All that has already been done on the client. So the workload you pass off to the server has to be worth that overhead.

              • 4. Re: PSoS results
                electon

                And on a second note. If you know how the UUID field is calculated, you can know it even before the record is created.

                One dangerous way of doing this would be to send that value with the PsOS script and not wait for completion.

                If something fails there's no way of knowing until you search for that value again.

                Anyway, If I knew what that UUID must be, I'd create a new record via relationship.

                http://www.modularfilemaker.org/module/transactions/

                there's an explanation in the comments of Todd's post.

                • 5. Re: PSoS results
                  taylorsharpe

                  Mike is correct.... you are not taking into account the entire startup script.  I usually put the first steps of a startup script to exit if its being performed by the server so as to not hinder scripts like this with a bunch of startup actions.

                  • 6. Re: PSoS results
                    siplus

                    Thank you for your thoughts.

                     

                    The database has only WindowClose triggers and all those scripts are protected by

                     

                    If [ PatternCount ( Get (ApplicationVersion); "server") ]

                        Exit Script [  ]

                    End If

                     

                    The Layout I'm going to has no triggers, is form view only, no header no footer no style and only contains the field UUID.

                     

                    The UUID is stored, indexed calc = Get(UUID) so no way to forecast its value.

                    • 7. Re: PSoS results
                      taylorsharpe

                      Go to Layout [“AppointmentData” (AppointmentData)]

                      SetVariable[$UUID; Value:Get(UUID)]

                      New Record/Request

                      Set Field [AppointmentDate::UUID; $UUID]

                      Exit Script [Result: $UUID]

                      • 8. Re: PSoS results
                        taylorsharpe

                        One other comment is that I agree this may not be the fastest process for creating a single record.  But if you wanted to created hundreds, thousands or millions, the PSOS will be much faster.  Also, you are probably testing locally on your machine.  Add a network in and bandwidth and latency makes this difference greater, especially if connecting over the Wide Area Network (internet).  Then things will be faster with PSOS. 

                        • 9. Re: PSoS results
                          wimdecorte

                          And also, not knowing what the specs on the server are, if the server is marginal and is in the middle of a backup or a lot of other user load (PSoS) or otherwise then the results will vary a lot.

                          • 10. Re: PSoS results
                            Mike_Mitchell

                            Indeed. The overhead associated with creating the new session (logging in the "user", allocating memory, etc.) only has to be paid once (per session). Each operation after that gets a free ride.

                             

                            And besides, paying 2/10 of a second's worth of overhead to create a session doesn't seem excessive. Especially, as Wim noted, when the server's load can vary considerably.

                            • 11. Re: PSoS results
                              electon

                              siplus wrote:

                               

                              The UUID is stored, indexed calc = Get(UUID) so no way to forecast its value.

                              If the uuid field was a auto-enter calculation you could place your value there. I don't know why the choice is a calculation field, so will not get into that.

                              The way to forecast the value is to run the function Get ( UUID ) first. It's supposed to create a unique value anyway.

                              Altho some say that it's not that reliable for uniqness.

                              I've put together a simple file so you can look t it up close.

                              • 12. Re: PSoS results
                                siplus

                                Thanks electon, for your replies and the example.

                                 

                                The table I wanted to create records in is not related to the one I am on and I didn't want to have a relationship.

                                Guess you can't have it all.


                                According to this article, the speed (as per jbante's measurements) should be impressive.


                                Taylor Sharpe: Testing was done at work in a client-server environment. Tomorrow, back in the office, I'll test this technique and report the msecs

                                • 13. Re: PSoS results
                                  siplus

                                  electon wrote:

                                  It's supposed to create a unique value anyway.

                                  Altho some say that it's not that reliable for uniqness.

                                   

                                  Filemaker says so...

                                  • 14. Re: PSoS results
                                    siplus

                                    And besides, paying 2/10 of a second's worth of overhead to create a session doesn't seem excessive. Especially, as Wim noted, when the server's load can vary considerably.

                                     

                                    Dear Mike, I'm happy for you that your clients are different from mine


                                    The PSoS alternative is perceived as slightly faster, must have to do with graphic card speed and OS X screen redraw. But the global field strategy could be the best of both worlds.


                                    I always test msecs in a client - user setup and with a 4 year old Mac client because I want to measure the worst our clients will be getting and tune around that.

                                    1 2 Previous Next