LibURL and TSNet in LC Indy

Charles Warwick charles at techstrategies.com.au
Wed Aug 19 00:52:16 EDT 2020


Hi Tom,

Using unique URLs for multiple load URL requests against the same server with the standard libUrl library allows you to *initiate* multiple requests at once, but the requests will still only be sent to the server one at a time in the background.

tsNet will send the requests to the server in parallel, which can significantly decrease the time taken to perform the requests (assuming the server can cope with the load).

If you want to see what I mean, download the following stack:

https://downloads.techstrategies.com.au/tsNet/tsNet_libUrl_loadUrl.livecode

Open this up in LC Indy edition, and click the “Get Foreign Exchange Rates” button several times to get an average total time.

Then disable tsNet by running the following command in a message box:

dispatch “revunloadlibrary” to stack “tsnetliburl”

Then click the button several more times and compare the time difference.

Regards,

Charles


> On 19 Aug 2020, at 2:39 am, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi Charles,
> 
> Thanks for that tip, I suspect that will work to improve those failures on
> TSNET
> 
> My rest API is local ...written in Golang using the Fiber Library......
> which is very impressive performance wise, and super easy to implement.
> 
> An interesting side note... .liburl has this 'one at a time' limitation but
> its possible to get around it by having a unique enough URL. which my use
> case gives me automatically.
> 
> So as a result I can actually launch a lot of requests asynchronously.
> 
> I need to really test these components well.....   so i will be posting
> some results. I just got it to work reliably yesterday.
> 
> Thanks again,
> 
> Tom
> 
> 
> 
>> On Mon, Aug 17, 2020 at 7:02 PM Charles Warwick via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> 
>> Hi Tom,
>> 
>> If you want to stress test an API using the tsNet library, try adding a:
>> 
>> tsNetLibUrlReuseConnection false
>> 
>> Before issuing the loadUrl commands to see if that makes any difference.
>> 
>> Also note that with tsNet, multiple load URL commands can occur at the
>> same time against a single server, where as without tsNet, I think that
>> libUrl will wait for one to complete before sending the next one.
>> 
>> So it is also possible that you are hitting the remote server harder when
>> you are using tsNet than with the standard libUrl.
>> 
>> Regards,
>> 
>> Charles
>> 
>>> On 18 Aug 2020, at 8:23 am, Tom Glod via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> Thank you sir. That worked.
>>> 
>>> I will try to diagnose the difference between the 2 libraries in this
>>> scenario...... if only to understand why its happening and not get burned
>>> elsewhere.
>>> 
>>> Thanks.
>>> 
>>> Tom
>>> 
>>> 
>>> 
>>> On Mon, Aug 17, 2020 at 4:41 PM Ralph DiMola via use-livecode <
>>> use-livecode at lists.runrev.com> wrote:
>>> 
>>>> Tom,
>>>> 
>>>> Your problem with tsNet could be a timeouts. See tsNetSetTimeouts
>>>> 
>>>> Disable tsNet:
>>>> dispatch "revunloadlibrary" to stack tsnetliburl
>>>> 
>>>> Enable tsNet:
>>>> dispatch "revloadlibrary" to stack tsnetliburl
>>>> 
>>>> Ralph DiMola
>>>> IT Director
>>>> Evergreen Information Services
>>>> rdimola at evergreeninfo.net
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On
>>>> Behalf
>>>> Of Tom Glod via use-livecode
>>>> Sent: Monday, August 17, 2020 4:32 PM
>>>> To: How to use LiveCode
>>>> Cc: Tom Glod
>>>> Subject: LibURL and TSNet in LC Indy
>>>> 
>>>> Hi Folks,
>>>> 
>>>> I am  stress testing a rest api using liburl, I will also do TSNET
>>>> 
>>>> But when I open my stack in Livecode Indy, the load URL command uses
>> TSNET
>>>> 
>>>> Whats funny is that half the requests are failing when it tries to use
>>>> TSNET. With liburl, 100% success rate using LC Community.
>>>> 
>>>> I am also calling a custom liburlcallback handler.
>>>> 
>>>> Is there any way to prevent indy from using TSNET by default?
>>>> 
>>>> Thanks
>>>> 
>>>> Tom
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription
>>>> preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>> 
>>> 
>>> --
>>> Tom Glod
>>> Founder & Developer
>>> MakeShyft R.D.A (www.makeshyft.com)
>>> Mobile:647.562.9411
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> Tom Glod
> Founder & Developer
> MakeShyft R.D.A (www.makeshyft.com)
> Mobile:647.562.9411
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list