another CFConfig question: i'm doing a cfconfig im...
# cfml-general
j
another CFConfig question: i'm doing a cfconfig import into lucee5. the cfconfig.json has 25 scheduled tasks defined, which seems to add a significant amount of processing time to the import. it's taking 3 minutes for the import, which is a lot of time in the context of my docker container startup. questions: • why so slow? • are there any ways to speed it up?
b
• no clue • we'd have to look to see what the heck it's doing
Can you grab a stack trace of the CommandBox process while it's importing to see what the main thread is up to
I can't imagine why that would be taking any time at all
j
that might be complicated. happen to have a link to instructions for grabbing the stack trace from commandbox?
b
I just use
jstack
which comes in the bin folder of any JDK
Copy code
jstack -l <PID>
👍 2
FusionReactor can be configured to run inside CommandBox, but that's prolly more work TBH
b
The first two show Lucee is loading it's core engine and the next to CommandBox is still compiling it's source files to run them
There's no reason any of this should take more than 10-15 seconds, even on a first start.
j
10-15s would be satisfactory
b
I don't see any indication of what's slowing it down. The threads aren't doing any file system access or downloads
It's just processing stuff
Is the CPU maxed out?
Is there any anti-virus present?
Something just seems to be making the container very very slow
j
this is in a lucee (official, not commandbox) container. i'll check CPU.
mem and cpu look decent, as far as i can tell:
b
Well, the process you're getting a stack trace from is a CommandBox command, no?
So the Lucee server really has nothing to do with it
The process is just booting up Lucee inside of the CLI and is taking forever for some reason
j
what i mean is that it's running in a docker container. the container has no virus protection in it.
b
So CPU is low even while the command is running?
That's really surprising
j
yeah, the command was running at the time of the attached htop.
(you can see the `box cfconfig`processes in the screenshot.)
b
I have absolutely no idea then.
We use CFConfig inside of docker all the time and have never had this issue
j
have you done it with a couple dozen or so scheduled tasks?
b
Question, you're not re-running the CFConfig command over and over, are you?
I assume you're doing a single import on a single JSON file that just has all the scheduled tasks within
j
single import of a single cfconfig.json
b
Then the number of tasks is irrelevant
In those stack traces, CommandBox and Lucee literally hadn't even finished bootstrapping, let alone import anything
I'm curious if you SSH into the container and just run something like
Copy code
box info
how long it takes
j
well, the problematic import has only imports on top my "base" cfconfig. another container running with the base config doesn't have that problem.
checking box info...
b
The stack traces you showed hadn't even reached the CFConfig logic itself, CommandBox and Lucee was still starting up, which leads me to think it's unrelated to the specificities of what you're importing.
j
which lucee, btw? commandbox's own lucee?
b
yes
j
box info is taking forever....
i'll provide the timing/output when it's finished.
b
yeah, something's not right 🙂
I assume it's related to the resources available to the container.
I don't really care about the output of the
info
command, I just wanted to rule out the CFConfig portions and test if Lucee starting up was slow all on its own
j
fyi, how i'm installing cfconfig in the base `Dockerfile`:
Copy code
### CFConfig Setup #################################
# Install dependencies
RUN apt-get update && \
    apt-get install -y curl gnupg unzip && \
    rm -rf /var/lib/apt/lists/*

# Add CommandBox GPG key and repository
RUN curl -fsSL <https://downloads.ortussolutions.com/debs/gpg> | apt-key add - && \
    echo "deb <https://downloads.ortussolutions.com/debs/noarch> /" | tee /etc/apt/sources.list.d/commandbox.list

# Update package list and install CommandBox
RUN apt-get update && \
    apt-get install -y commandbox && \
    rm -rf /var/lib/apt/lists/*

# Install CFConfig
RUN box install commandbox-cfconfig
#===================================================#
here's a first run of `box info`:
Copy code
vagrant@local:~$ time docker exec -it $(get_a_container_id_from_service.sh hudx_local_lucee-manager) bash -c 'box info'
Current version higher than installed version! 
  *current: 6.1.0
 installed: 6.0.0

*updating installed jars
Library path: /root/.CommandBox/lib
Initializing libraries -- this will only happen once, and takes a few seconds...
Cleaning old Felix Cache...
.........
Libraries initialized

****************************************************************************************************
*                                         About CommandBox                                         *
****************************************************************************************************
*                                                                                                  *
*                                                                                                  *
*  CommandBox Version: 6.1.0+00813                                                                 *
*  CommandBox Authors: Brad Wood, Luis Majano, Denny Valiant                                       *
*  CommandBox Binary   /usr/local/bin/box                                                          *
*  CommandBox Home     /root/.CommandBox                                                           *
*  CFML Engine:        Lucee                                                                       *
*  CFML Version:       5.4.6.9 stable (Gelert)                                                     *
*  Java Version:       11.0.20 (Eclipse Adoptium)                                                  *
*  Java Path:          /opt/java/openjdk/bin/java                                                  *
*  OS Username         root                                                                        *
*  JLine Terminal      org.jline.terminal.impl.PosixSysTerminal                                    *
*  Runwar Version      5.0.8 (/root/.CommandBox/lib/runwar-5.0.8.jar)                              *
*                                                                                                  *
*                                                                                                  *
****************************************************************************************************


                                  Here is an ASCII art stereogram.
                   Stare at it and diverge your eyes (the opposite of crossing them)
                             If you can't see it, you can come back later.
                This image will be here all day.  Tomorrow holds a new day and a new image.





                           @              @              @              @
              .GHu>K@i>g@y+$Y.GHu>K@i>g@y+$Y.GHu>K@i>g@y+$Y.GHu>K@i>g@y+$Y.GHu>K@i>g@y+
              yno$]J+hI2g0&O@yno$]J+hI2g0&O@yno$]J+hI20&O@yno$]JJ+hI20&O@yno$]JJ+hI20&O
              |IBOxmr{li^7!NW|IBOxmr{li^7!NW|IBOxm{li^7!NW|IBOxm{li^77!NW|IBOxm{li^77!N
              k0]JwpQ:GxaZ\=>k0]JwpQ:GxaZ\=>k0]JpQ:GxaZ\=>k0]JpQ:GxaZ\==>k0]JpQ:GxaZ\==
              zsHE>{(a.K|Qs\ezsHE>{(a.K|Qs\ezsE>{(a.K|Qs\ezsE>{(a.K|Qs\ezzsE>{(a.K|Qs\e
              )N{dE:kPaN_xbCp)N{dE:kPaN_xbCpN{dE:kPaN_xbCpN{dE:kPaN_xbCpN{ddE:kPaN_xbCp
              ,9nS$e:W<MjCu6',9nS$e:W<MjCu6,9nS$eW<MMjCu6,9nS$eW<MjCuu6,9nS$$eW<MjCuu6,
              O8!2'dEz#49Nti>O8!2'dEz#49Nt>O8!2'Ez#499Nt>O8!2'Ez#99Nt>>O8!2'EEz#99Nt>>O
              &Sluv_lQnc<)+Xi&Sluv_lQnc<)Xi&SluvlQnc<<)Xi&SluvlQn<<)Xii&SluvlQQn<<)Xii&
              !zO<1:{$]j+,^CX!zO<1:{$]j+,CX!zO<1:$]jj+,CX!zO<1:$]j+,CCX!zO<1:$$]j+,CCX!
              XYJC@=.ohaN/U^CXYJC@=.ohaN/^CXYJC@=.ohaN/^CXYJC@=.ohaN/^CXYJC@=..ohaN/^CX
              {pQZgT!Vk4)2|qz{pQZgT!Vk4)2qz{pQZgT!Vk4)2qz{pQZgT!Vk4)2qz{pQZgT!!Vk4)2qz{
              NoPA^ohY6kt-_h]NoPA^ohY6kt-h]NoPA^ohY6kt-h]NoPA^ohY6kt-h]NoPA^ohhY6kt-h]N
              q>K0Yz?DU&w`&gxq>K0Yz?DU&w`gxq>K0Yz?DU&w`gxq>K0Yz?DU&w`gxq>K0Yz??DU&w`gxq
              tUb_$U.Od-&Ky&otUb_$U.Od-&K&otUb_$U.Od-&K&otUb_$U.Od-&K&otUb_$UU.Od-&K&ot
              Cxm.7pI2O@yf(Y*Cxm.7pI2O@yf(*Cxm.7I2OO@yf(*Cxm.7I2OO@f(**Cxm.77I2OO@f(**C
              v;@1>/0%B_0Iw@!v;@1>/0%B_0Iw@v;@1>/%B_00Iw@v;@1>/%B00Iww@v;@11>/%B00Iww@v
              aRK|MV3d)&7("/0aRK|MV3d)&7("/0aK|MV3d&7("/0aK|MV3d&7(("/0aK||MV3d&7(("/0a
              $evW85:WL%zCQnk$evW85:WL%zCQnk$eW85:WL%zQnk$eW85::WL%zQnk$eeW85::WL%zQnk$
              Gt!bs<m.CHIFT)2Gt!bs<m.CHIFT)2Gt!b<m.CHIFT)2Gt!b<m.CHIFT))2Gt!b<m.CHIFT))
              JcPe^stE6gD1WXeJcPe^stE6gD1WXeJcPe^st6gD1WXeJcPe^st6gDD1WXeJcPe^st6gDD1WX
              ildea<'d!>m<S>gildea<'d!>m<S>gildea<'d!>mS>gildea<S'd!>mS>gildea<S'd!>mS>
              TQn#PA&{h9jKE6STQn#PA&{h9jKE6STQn#PA&{h9jKE6STQn#PA&{h9jKE6STQn#PA&{h9jKE
              



real    4m24.330s
user    0m0.073s
sys     0m0.123s
how to prevent auto-update checks? they don't make sense in the context of container runtime
b
Well, they only run when you open the shell
One off commands shouldn't fire it
but there is a module setting for it, or you can uninstall that module
j
it seems like my one-off box commands do the checks, currently. am i wrong about that?
Copy code
Current version higher than installed version! 
  *current: 6.1.0
 installed: 6.0.0

*updating installed jars
Library path: /root/.CommandBox/lib
Initializing libraries -- this will only happen once, and takes a few seconds...
Cleaning old Felix Cache...
.........
Libraries initialized
b
oh, that's not the update check
That's because you seem to have a newer binary than the version unpacked in your commandbox home
Not really sure how you've accomplished that
You'd have to install CommandBox and then re-download a newer binary to get that
That's normal that on start, it will "finish" the upgrade
j
i pasted in my (Dockerfile) commandbox installation, above. then, in the entrypoint, i run:
Copy code
#!/usr/bin/env bash

# use cfconfig to translate the cfconfig.json file to the web configuration format that lucee expects
{ \
  time box cfconfig import \
    from=/tmp/cfconfig.json \
    to="${LUCEE_WEB_DIR}" \
    toFormat=LuceeWeb@5.1 ; \
} \
    > /tmp/cfconfig_stdout.log \
    2> /tmp/cfconfig_stderr.log
i also don't know why i'd have something out of sync. am i doing something wrong, given my installation process and my cfconfig import process?
b
I don't see anything wrong with that
I don't use the apt repos much myself so I wonder if it's pulling the right binary 🤔
Weird, I just tried your setup commands in a fresh ubuntu container, and I get this error when I try to run java
Copy code
root@97d03dd4aaca:/# java --version
bash: java: command not found
Is java not immediately usable in the same shell?
j
try
lucee/lucee:5.4.3.2-light-tomcat9.0-jdk11-temurin-jammy
, pls. that's the image i'm using.
b
well, I wanted to start simple, lol
Our debian package installs java, but it's not working
I'll try Lucee's, which I'm sure comes with Java already
j
> Our debian package installs java, but it's not working I got a different impression from the commandbox docs, for what it's worth: docs: > If you do not have Java installed you can install it with the following command. >
Copy code
sudo apt install openjdk-11-jdk
^ that's right after the commandbox package installation instructions
b
yeah, dunno really. Our Debian packages are created by a really old CFDistro Ant build that Denny V set up many many years ago and I've never touched it.
I don't really know how it works, lol
😃 1
I ran your same setup commands in a Lucee container and then ran
box info
. it completed in just a few seconds and didn't say anything at all about having an our of date binary
Copy code
root@fe8802c0d446:/usr/local/tomcat# box info
Configuring CommandBox home: /root/.CommandBox (change with -CommandBox_home=/path/to/dir)
Library path: /root/.CommandBox/lib
Initializing libraries -- this will only happen once, and takes a few seconds...
...
Libraries initialized

****************************************************************************************************
*                                         About CommandBox                                         *
****************************************************************************************************
...
🤔 1
Subsequent runs of
box info
take just a few seconds and there are upgrade warnings
j
trying it myself with the fresh lucee image
my first and second runs look pretty much the same on a fresh box. 12s for
box info
.
Copy code
root@c834f2554ac5:/usr/local/tomcat# time box info

****************************************************************************************************
*                                         About CommandBox                                         *
****************************************************************************************************
*                                                                                                  *
*                                                                                                  *
*  CommandBox Version: 6.1.0+00813                                                                 *
*  CommandBox Authors: Brad Wood, Luis Majano, Denny Valiant                                       *
*  CommandBox Binary   /usr/local/bin/box                                                          *
*  CommandBox Home     /root/.CommandBox                                                           *
*  CFML Engine:        Lucee                                                                       *
*  CFML Version:       5.4.6.9 stable (Gelert)                                                     *
*  Java Version:       11.0.20 (Eclipse Adoptium)                                                  *
*  Java Path:          /opt/java/openjdk/bin/java                                                  *
*  OS Username         root                                                                        *
*  JLine Terminal      org.jline.terminal.impl.PosixSysTerminal                                    *
*  Runwar Version      5.0.8 (/root/.CommandBox/lib/runwar-5.0.8.jar)                              *
*                                                                                                  *
*                                                                                                  *
****************************************************************************************************


                                  Here is an ASCII art stereogram.
                   Stare at it and diverge your eyes (the opposite of crossing them)
                             If you can't see it, you can come back later.
                This image will be here all day.  Tomorrow holds a new day and a new image.


              SNIPPED OUT



real    0m12.333s
user    0m19.106s
sys     0m3.064s
so not super fast but not minutes long. 🤔
i think i figured it out. the container normally sips resources and i've got the cpus constrained:
Copy code
# swarm config
...
    deploy:
      resources:
        limits:
          cpus: '0.2'
but apparently commandbox (even
box info
) is fairly CPU-intensive. if i increase
cpus
to
1
, i get more reasonable execution time (
14s
for
box info
). i can bump up the resources but it's kind of a shame that
cfconfig
requires the container to have a bumped-up resource allocation just for a fleeting entrypoint process.
b
Well, CFConfig isn't doing anything different in terms of loading Lucee than your Tomcat server is. I would expect it to be just as slow starting up and loading classes.
j
i don't completely understand the issue, either, because i have a lucee service and the lucee-manager (responsible for gateway code and scheduled tasks). they both share a base image. even with a small, original allocation, the lucee container runs
box info
normally, whereas the other one needs more resources to do the same. so something's different, but i don't know what. i'm just going to bump up the resources on the weird service and call it a day. maybe i'll revisit it in the future to find the root cause if i work up the energy.
👍 1