Announcement

Collapse
No announcement yet.

MvASYNCHRONOUS ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MvASYNCHRONOUS ?

    I just came across this tag from a few version ago and it peaked my interest. Can anyone share some insight on when, where, why and how it would be used?
    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com

    #2
    http://www.mivascript.com/item/mivascript-tags/MvASYNCHRONOUS.html

    You would primarily use it as a background task where you don't want to block the foreground task. Miva Merchant uses it to run its Scheduled Task feature. A super simple example could be you have a form that sends an email to the user submitted email address, but you don't care about showing whether the email was successful or not and maybe connecting to the Mail Server takes a few seconds and then a few more to send it. The page load time could be 5+ seconds but if you did your MvSMTP within the MvASYNC tag the page would load instantly and the Mail Server call would be done in the background. Again that is just a simple idea on how it could be used.
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      ok - cool. So it would be like an "inline" ajax call - but without waiting on a response. And you don't need to call a separate file (but could - like an MvCall???).... correct? And I assume you can not pass info back to the initiating file?
      I actually see where this could be an awesome bit of code... hmm.....
      William Gilligan - Orange Marmalade, Inc.
      www.OrangeMarmaladeinc.com

      Comment


        #4
        Yes you can do anything you want within it, but it is an entire new thread / process so you'd need to re-open any database connections, etc...
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          Would this have any effect on MySql writes? Would it (could it) actually speed things up when all that is needed is say a series of database writes? I understand that it would need its own error checking, but heck - if this is as powerful as it seems off hand - this could make things smokin fast under some circumstances.
          William Gilligan - Orange Marmalade, Inc.
          www.OrangeMarmaladeinc.com

          Comment


            #6
            You'd have to benchmark all of it and see if it makes sense for you. You'd also have to remember it's still using the same computing power just in a different thread / process so it may hinder you in other cases.
            David Carver
            Miva, Inc. | Software Developer

            Comment


              #7
              Just a followup from the other post: You said above "yes you can do anything you want within it, but it is an entire new thread / process so you'd need to re-open any database connections, etc..."
              So this actually creates a "multithread" scenario, so I could generate multiple rapid fire mvasynchronous threads and each would do there own thing (ie - purchase a ticket from a remote site and record the results).. Is this correct thinking? The only limit on my end would be the initiating script, and each individual mvasynchronous thread, and CPU power.... correct?
              William Gilligan - Orange Marmalade, Inc.
              www.OrangeMarmaladeinc.com

              Comment

              Working...
              X