What makes the Virtualmin left menu so slow?

Running on a decent server (nothing super fast, but a 2 processor Celeron), I can see 3 seconds for that to come up, and close to 100% cpu.

Running on an Atom processor with 4 cores, I can see it takes 4-5 seconds and it consumes 1-2 cores with high percentages during that time.

So, that begs the question, what is the slow part of that process, is there anything I can do to make it faster? It's strange to me that it's that darn slow to paint the screen, plenty of other apps respond very quickly.

Heck, even Webmin does. If I click on the Webmin tab, it comes up fast. When I click back on Virtualmin, dog slow.

Status: 
Closed (fixed)

Comments

The cause could be slowness parsing the database of domains .. how many do you have?

Also, when the left frame loads do you see a noticeable delay during any part of the left menu?

Should you need to get into further details about this, you could use the top or atop command to spot which process uses the high load. I suppose it'll be Webmin's miniserv.pl.

And you can turn on Webmin's debug logging in Webmin -> Webmin Configuration -> Cute ladybug. The log contains time stamps, so might be able to see which part of which script execution takes a long time. Note: The log quickly grows very large if you turn on many features to log, so check it regularly and don't leave it on "unsupervised". :)

Yes, on the left menu, I see the line near the top that says "Create virtual server" and it pauses for a few seconds. In top, it simply shows perl as the process that is so busy.

So, I turned on debug logging (attached). If I read it correctly, it starts when I see the START "script=left.cgi" as the stuff before it is likely from turning it on within webmin, I selected all logging options. Looks like it's in seconds, not any finer measurement.

It obviously reads tons of stuff to simply display the left menu. I know some of this is for the status on top. But that comes up pretty quickly.

Only one event seems to take any time other than a fraction of a second, that's the read of /etc/sysconfig/network. And that was only 2 seconds.

Is there any way this can be improved? It's just hard to believe it should take 6 seconds and all this work to display the left menu! Esp with perl at 80%+ Yes, I realize a faster machine means faster response, BUT, if there was a way to improve this, everyone would benefit and it would seem quicker on any cpu.

Some of these language files are quite large. Randomly picked one:

/usr/libexec/webmin/bind8/lang/en

That's 45k, of which you likely read it to find one line out of 1,088 lines. It reads all of the http configuration files, not sure why.

Just seems like this could be improved vastly. Says he who didn't write the code of course.

I had a look at this today, and noticed that on my system there is a delay of about a second between the time "Create virtual server" appears and when the rest of the menu does. I'm going to dig into the code to see what the cause is ..

sfatula - how many domains are you hosting on this system?

BTW - I have 4 domains on the system (slowest one).

Also, any way to get the CPU time consumed by the left menu process? I would submit that even 1 CPU second is way too much for a left menu.

I'm still digging into the code to see what makes that frame so slow. On my systems it takes 1-2 seconds, versus sub-second for other pages. I will update this bug once I have a fix ..

Can virtualmin be run under mod_fcgid? i.e., fastcgi?

No - it runs within its own webserver. However, this means that it gets many of the benefits of fcgid already, like not needing to load perl or a huge bunch of libraries for each request.

By the way, how much RAM does your system have?

4GB ram, using hardly any of it.

I've been doing some more debugging on this, and found that one major cause of slowness is having a lot of Virtualmin plugins enabled. I would recommend disabling those that you are not using, at System Settings -> Features and Plugins, by de-selecting the checkbox in the first column.

Also, make sure that at System Settings -> Virtualmin Configuration you have "Preload Virtualmin libraries at startup?" set to "All libraries".

Everything not being used us un fact disabled. Preload is set to yes.

My main point is whether or not there are 1,000 plugins, there should be a way to make it un-necessary to slow down the display of the left hand menu, perhaps it can be cached somewhere for example. The left menu is static, except when things are changed, It should be extremely fast!

On your CPU, I bet the left menu takes > 1 CPU second, not elapsed second. I say it should be maybe .01 cpu seconds.

On a hosting platform, which is what virtualmin is for of course, it is likely almost all options will always be selected.

You would make sooo many people happy if this looked much quicker!

Unfortunately the left menu is actually quite dynamic - it contains links to all the features for each domain and all global settings, which change based on enabled features.

That said, there is some caching I can do, and those links don't change most of the time you select a domain. I'll update this bug with further progress ..

ronald's picture
Submitted by ronald on Thu, 12/09/2010 - 01:42 Pro Licensee

I have noticed a few times when DNS for a domain is not correct, the left menu takes forever.
It wouldn't hurt to check networking/dns for the domaina so that the domains can be resolved quickly

Ok, I have completed code that adds caching for the left menu, which will make it significantly faster. This will go into the 3.83 Virtualmin release..

DNS is correct, so, not an issue. YOu are welcome to log into our server if you think that might help. In my experience, lower machines are GREAT for finding speed improvements!

Automatically closed -- issue fixed for 2 weeks with no activity.