Call for a contributor: LC Server enhancement
Richard Gaskin
ambassador at fourthworld.com
Sat Mar 30 15:44:44 EDT 2019
I've obtained approval from the LC team for an enhancement that can
improve performance and reduce system resource use for LC Server and
faceless standalones.
This would seem an easy fix for someone who knows their way around the
code base, described here:
https://quality.livecode.com/show_bug.cgi?id=14115#c5
Background
----------
By default, LC initializes all fonts available on a system at startup.
For the GUI this is usually what we want.
On a server, it us usually what we don't want.
Although it is possible to generate custom graphics in LC Server, which
may depend on assigning fonts to specific objects, most server work
doesn't involve any graphics at all.
On some hosts, this is not a problem because they have few fonts
installed. But on others, like the popular Dreamhost, this has become a
problem, as DH makes a wide range of fonts available.
Each fonts initialized by the LC engine consumes time and memory.
Roughly 3/4 of the LC boot sequence is related to font initialization.
Keep in mind that as a CGI or any command line use, LC's boot sequence
comes into play with each request.
Whether using LC Server or running an LC standalone facelessly, using it
as a CGI or calling from the command line is impacted in both CPU time
and memory requirements by having so much font activity.
On some systems, the additional memory required has made LC Server and
even LC standalones prohibitive, disallowing them to run under certain
load conditions. Indeed, this issue came to my attention while
attempting some LC work on Dreamhost, ultimately diagnosed with the help
of DH's excellent support staff, along with Mark Waddingham and Peter Brett.
Proposed Solution
-----------------
We value backward compatibility and maximizing options with minimal
extra work. For this reason, the proposed change preserves all existing
LC Server and LC standalone use in any CGI or other command line context.
The request is for the addition of an optional flag, "-f", which would
cause LC's boot sequence to bypass the font loading sequence.
For LC Server, this would look like this:
./livecode-server-community -f
For standalones, it compliments the existing "-ui" flag to allow a
standalone to run facelessly, and would ideally be available either by
itself or added to the "-ui" flag:
./MyFacelessApp -ui -f
./MyFacelessApp -uif
Next Steps
----------
The team is supportive of his enhancement, but currently has other
priorities. I'm quite keen for anything that expands the range of ways
LiveCode can do powerful work on par with other scripting languages on
servers and in the command line, but my C skills are so rusty I'm sure
no one wants my C code in the code base.
So what we need is anyone with the intersection of skills, interest, and
time to find the entry point for the font initialization, and ad a
condition which would bypass font initialization if "-f" is among the
arguments passed to the engine from the command line.
By making LC more more performant and less resource-intensive, it would
expand the scope of ways it can be used where other scripting languages are.
I'm afraid that's the only motivation I can offer. My need here is
mostly for the benefit of LC adoption and usage, and I have nothing to
offer by way of a bounty beyond perhaps a beer at the upcoming conference.
But on the upside, I believe that as changes go, this one would be
reasonably straightforward to implement.
Any takers?
--
Richard Gaskin
LiveCode Community Liaison
More information about the use-livecode
mailing list