Livecode Server performance

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Fri Apr 16, 2021 7:36 pm

This question cuts to the heart of things:
keliko wrote:
Tue Apr 13, 2021 3:48 am
is there any way to do optimization?
Always.

And while there are many things we can do to optimize our configuration (from bypassing LC's font init to the biggest improvement, moving from a shared host to a VPS), often we find opportunities to speed things up in our own scripts.

Let's look at the original test script as an exercise. What do you notice when you run this in the IDE?:

Code: Select all

on mouseUp
   put 0 into myVar
   repeat for 100 times
      add 1 to myVar
      put myVar
   end repeat
end mouseUp
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Livecode Server performance

Post by AxWald » Fri Apr 16, 2021 9:51 pm

Hi,
FourthWorld wrote:
Fri Apr 16, 2021 5:33 pm
If your server will run LC 6.7, go for it.
I may give it a try (it's easy enough once you know-how), but I fear Ubuntu 20.04 as server will not have the 32bit libs required :/

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Livecode Server performance

Post by bogs » Fri Apr 16, 2021 10:53 pm

AxWald wrote:
Fri Apr 16, 2021 9:51 pm
I fear Ubuntu 20.04 as server will not have the 32bit libs required :/
Hm, I installed U-20.04 as a server initially, added my desktop, etc. multiarch should work out regardless of what you started with, i.e.

Code: Select all

dpkg --add-architecture <arch> # in this case, probably i386 or i686...
should add the 32 bit libs needed if you want to run something 32 bit on the 64 bit server side. Since your talking about server specific stuff, I tend to doubt you would need to add some of the peculiar bits and bobs you'd need for the gui end of things. For instance, to install Lc gui vers. from 6.7 back, I generally do the above for multi arch, then add the following - [gtk2 required for 32 bit program on 64 bit linux distro]

1. after making sure you have added the architectures, update then upgrade the system, just in case.

2. {apt or apt-get} install libgtk2.0-0:i386

3. Another thing to note is that Lc 6.7.x requires the 32bit libstd6c++. This can be added with -
apt install lib32stdc++6

That is pretty much all I've found missing when working backwards with Lc, YMMV. Good luck ;)
Image

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Livecode Server performance

Post by AxWald » Sat Apr 17, 2021 12:44 pm

Hi,

tested. My shared server doesn't support the 32-bit subsystem, as expected.

I might try to explain why I'm so happy with my shared servers:
  • My applications are used in commercial environments, my customers are small wholesalers.
    I don't host myself, nor do I sell anything, nor do I do any administrations. (This has become a minefield, & a task above my abilities.) I only sell my services as OSS coder/ consultant. This avoids a lot of complications.
    So the customer is responsible to provide a working & managed environment.
    .
  • Using a "shared server @ competent hoster" has shown to be a perfect choice:
    Very low costs, high reliability, sufficient security, tolerable performance.
    .
  • Pro's:
    What we don't need to care about anymore:
    • Providing & maintaining powerful hardware
    • Stockpiling replacement hardware
    • Providing a high speed, low latency internet connection for the server
    • Caring about functional backups (try to get this done in house, and despair!)
    • Providing 24/7/365 emergency reaction
    • Keeping OS & server components up to date
    • Monitoring security bulletins, pentesting beyond my own software, caring about DDOS protection etc. etc.
  • Con's:
    What toads we have to swallow:
    • We get a "standard server" & our choice of additional software is limited.
    • It can happen that a "server hog" is put on the same machine. In one such case we got moved to another machine within hours of our support call.
    • Generally the performance is not what you have on a dedicated server. But the cost for a dedicated server providing our "experienced minimum performance" would still be multitudes higher.

FourthWorld wrote:
Fri Apr 16, 2021 5:33 pm
if there were a Lean Edition of LC Server I'd like it, not so much for the size but for the fewer sys calls on boot.
Where can I sign? ;-)
I don't understand what the ppl @ mothership are thinking, cramming this kind of stuff into a dedicated server version, seemingly w/o call for, and w/o even a slight notice anywhere.

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Sat Apr 17, 2021 6:27 pm

AxWald wrote:
Sat Apr 17, 2021 12:44 pm
FourthWorld wrote:
Fri Apr 16, 2021 5:33 pm
if there were a Lean Edition of LC Server I'd like it, not so much for the size but for the fewer sys calls on boot.
Where can I sign? ;-)
LC's Community Edition is an excellent fit for most server work, and being GPL-governed we can fork the existing code base to make it do whatever we like.

I don't know about your C++ skills, but mine are so atrophied no one wants me monkeying with engine code. We'd need to bring a C++ coder in on this. We could hire the team, but their rates are high as any work requires pulling a resource from other tasks. So probably more cost-effective to hire someone from the community.

Might we put together a bounty on this?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Livecode Server performance

Post by AxWald » Sun Apr 18, 2021 2:20 pm

Hi,
FourthWorld wrote:
Sat Apr 17, 2021 6:27 pm
I don't know about your C++ skill
Not existent :)
FourthWorld wrote:
Sat Apr 17, 2021 6:27 pm
Might we put together a bounty on this?
Tbh, no, sorry. No incentive for me - after all I don't need Server 9: There's nothing in it that I really need as long as Server 8 works. If it shows that LC server makes sense for me, at all.

And I'm absolutely unhappy with the direction RunRev takes with the new versions, and with their new way of delivering their products - I don't want to support this.
I'm grateful for LC 6.7.10 Community; this is a great product IMHO, so I try to "pay back" in doing my best being helpful in the forums & reporting bugs (as my time allows). But that's it.

What I'd support would be a fork of LC from the 6 series:
First creating 64-bit versions of it, with emphasis on Windows, Linux and Android (where there's money to earn for the coder). If necessary & too much hassle, even scrapping Apple support.
Then ironing out bugs. Lather, rinse, repeat. Again.
Then adding a native data structure & native visual representation of row/column data, including real arrays (not only hash tables).
A "LC Classic LTS" for professional coders - well, guess this will remain a dream of a grumpy old coder.
Atm there's no thought of it anyways - corona lock-down everywhere, customers struggling, it's not the time where there's much free money available.


Btw., I got adventurous & installed a generic Ubuntu 20.04.2 server on a spare machine. After an epic battle with Samba I actually got LC server Linux-64 9.6.2 rc5 running, only libFontConfig was missing. I also installed 8.2, works as well.

Only LC 6 makes problems - a "ldd" shows "not a dynamic executable" (but "stat" gives equal information as 8/9).
Anyways, now another dungeon has to be conquered before I can start testing: installing Apache & coercing it to run CGIs ...

Have fun!

Memo to myself: Stop writing off topic!!!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Sun Apr 18, 2021 4:14 pm

That you have it down to just one unmet dependency is quite encouraging, Ax. Not only is that consistent with what I can reproduce here, but it also isolates the opportunity for leaner operations by providing an option to bypass font init (perhaps graphics altogether, for those who don't want to export custom images).

But even as it is, once dependencies are met performance is surprisingly good.

This thread prompted me to look more deeply at server performance metrics than I'd had before. I even set up an account with Loader.io to use the same measurement system used by yourself and Keliko (siege is normally my go-to for that).

Among other things I learned that once we eliminate the inevitable muddying "noisy neighbor" effect by moving the test away from a shared host, and we eliminate errors on the test setup, LC performs remarkably well.

The test being used in this thread to establish a sort of baseline is either a really good or really horrible test, depending on what aspect one is interested in testing.

The mouseUp-driven version I posted just a couple replies ago may help shine some light on why the test is an odd choice for attempting to establish any sort of general baseline, for reasons which may become clearer when it's run in the IDE.

When Keliko returns with observations from running that test in the IDE I'll write more about what that test is -- and more importantly, isn't -- showing us. In short, it isolates one specific aspect of server processing that may be worth studying in some specific circumstances but doesn't tell us much about common real-world usage patterns.

The use/bin/time test I posted results from earlier suggests that LC takes less memory than PHP, which is also very encouraging.

On a compatible system sufficiently isolated to make testing practical, LC Server appears to perform admirably well.

If/when the team can provide an option to bypass font init, not only will LC Server be able to meet the expectation of running out-of-the-box on common Linux server configs, but it will be even lighter with system resources than it is now, allowing its already-good performance to shine even more brightly.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

keliko
Posts: 85
Joined: Thu Aug 01, 2019 8:15 am

Re: Livecode Server performance

Post by keliko » Tue Apr 20, 2021 4:51 am

FourthWorld wrote:
Sun Apr 18, 2021 4:14 pm
When Keliko returns with observations from running that test in the IDE I'll write more about what that test is -- and more importantly, isn't -- showing us. In short, it isolates one specific aspect of server processing that may be worth studying in some specific circumstances but doesn't tell us much about common real-world usage patterns.
I have observed that Livecode works much faster. but in this post i'm talkin "concurrent"
where some of my clients always ask to do "server capacity planning" and they usually use loader.io to simulate how we handle hundreds of requests per second. so I have to feed them the data from the test results with the loader.

devoid of meaning and presumption Livecode is very slow compared to other languages. Livecode is the primary language of our softwarehouse. previously we used javascript and php.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Tue Apr 20, 2021 5:30 am

Good to see you back, Keliko.

What did you find when you ran the test in the IDE?

Did it spark any curiosity about the implications in a server environment?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

keliko
Posts: 85
Joined: Thu Aug 01, 2019 8:15 am

Re: Livecode Server performance

Post by keliko » Tue Apr 20, 2021 10:14 am

I have tried it in a server environment and the results are not disappointing.
but the results from loader.io livecode were very disappointing

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Tue Apr 20, 2021 6:52 pm

keliko wrote:
Tue Apr 20, 2021 10:14 am
FourthWorld wrote:
Tue Apr 20, 2021 5:30 am
What did you find when you ran the test in the IDE?

Did it spark any curiosity about the implications in a server environment?
I have tried it in a server environment...
Please keep us posted if you decide to run the exercise I provided.

...and the results are not disappointing.
but the results from loader.io livecode were very disappointing
The seeming paradox of LC Server simultaneously appearing both "not disappointing" yet also "very disappointing" is resolved in my earlier replies.

To summarize, we've identified three reasons why the testing methodology as presented cannot be conclusive:

- Loader is explicitly reporting that it's measuring error overhead rather than performance, because it frequently can't even complete the test at all.
- Shared hosting is an unstable testbed given the "noisy neighbors" problem.
- The specific test script chosen isn't testing what it might appear to be testing.

If you have any curiosity at all about any of these, I'd be happy to answer any questions you may have as best I can once you run the exercise I provided so we have a common basis of understanding to work from.

Best of luck with your explorations.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

keliko
Posts: 85
Joined: Thu Aug 01, 2019 8:15 am

Re: Livecode Server performance

Post by keliko » Wed Apr 21, 2021 12:40 am

the meaning of the paradox in this context is dubious.
I almost forget i also did the test using Apache Benchmarks and I haven't tried it using jmeter.
from there we can judge how the server is performing.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Thu Apr 22, 2021 1:51 am

There doesn't appear to be any problem with the measurement tooling, though it certainly doesn't hurt to add more.

But you will find no noteworthy difference until you address the three issues already revealed in this thread, summarized in my last reply.

Left unaddressed, they will make any performance test results at best questionable, and at worst possibly even misleading.

If you're sincerely interested in finding practical ways to improve both performance and the design of tests to measure that performance, feel free to ask questions.

A good place to start would be with the test script itself. Run the example I provided for you above in the IDE. It'll take mere seconds. If you want to spend more time than that, run the server test with strace. Report back with what you see, and any questions that may spark. We're here to help.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Livecode Server performance

Post by AxWald » Thu Apr 29, 2021 4:37 pm

Hi,

did some more tests. What did I find?
  • For my convenience I wrote a simple tool to test CGI response times. See attachment. *1)
    .
  • Feeling adventurous, I installed the LC 7.1.4-64 server on my hosted server. Doesn't run, too, so there's only the LC 8 servers that will run out-of-the-box on "real servers". And LC 8.2 looks considerable faster than 8.0.
    .
  • Since Android doesn't love 'http' anymore, I moved a crucial PHP script (echo $_SERVER['REMOTE_ADDR'];) from its old home to my own 'htpps' domain. *2) And since I was at it, I changed the PHP version there to 8. Whow!
    Fun fact: I cannot help feeling my LC CGIs in this domain are faster now, too - can this be?
For those interested, a typical result (all on the same shared server):

Code: Select all

https a.htm:	50.3 ms	a
https PHP 8:	52.4 ms	[my public IP]
http PHP 7.2:	60.1 ms	[my public IP]
https LC 82:	76.1 ms	[my public IP]
https LC 8:	96.3 ms	[my public IP]
"a.htm" fetches a simple .htm, containing only "a" - this should be latency & basic apache reaction time, as a base value.
The LC version of the above PHP is "put $_SERVER["REMOTE_ADDR"]", btw. 35 Bytes instead of PHPs 38 ;-)

Have fun!

*1): It's a simple stack where you can enter the URLs to some CGIs (or web pages ...), and run a loop with all these. It measures the response times & collects the results (that are supposed to be short ...). The results are compared - it's expected they are identical. If not, it's seen as an error.
Finally it calculates the ~ms for 1 response & shows this. Really simple, but comes quite handy :)
Be careful with your scripts - any result containing quotes or longer than 1 line will crash! (this may be changed in the next version ...)

*2): I use this in my programs to determine if our servers are running, and if we have internet. This PHP is called quite often, and it's important that it works flawlessly.

Edit: Made a better version of the attached tool. Look some posts ahead ...
Attachments
awaCGITest.zip
Test your CGIs response times with this!
(8.72 KiB) Downloaded 193 times
Last edited by AxWald on Fri Apr 30, 2021 12:08 pm, edited 1 time in total.
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server performance

Post by FourthWorld » Thu Apr 29, 2021 4:54 pm

Thank you, Ax. Is the script you were testing on the server included in the tool? Can you post it here?

If it's just the same one used earlier in this thread, it may be helpful to run the test I noted above in the IDE to get a better feel for what that particular test is - and isn't - showing us.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “CGIs and the Server”