Author Topic: Latest hostbill versions are slower ?  (Read 139 times)

0 Members and 1 Guest are viewing this topic.

Offline andika

  • 151
  • -1
  • Active Participant
  • ****
Latest hostbill versions are slower ?
« on: July 04, 2018, 07:16:16 AM »
Hello,

Are the latest hostbill versions slower ? It seems like it takes more seconds to load the website, but the most annoying thing is "Login as Client" it takes exactly 25 seconds every single time.  I'm using php 5.6 on server, all other recommendations are respected as described here https://hostbill.atlassian.net/wiki/spaces/DOCS/pages/53745197/System+requirements

Offline tallship

  • 616
  • 19
  • Active Participant
  • *****
  • Manager Network Services
    • Skype - tallship
    • Business Internet and Telephony since 1985.
Re: Latest hostbill versions are slower ?
« Reply #1 on: July 04, 2018, 09:07:53 PM »
Okay, first, you do understand that things get fixed, IF they're going to get fixed, when they get fixed. Right? You can open a trouble ticket and I forget how much that costs, but then you still have to pay for the time it takes Kris to fix whatever is broken, so you might be better off just waiting for it to become a problem for a lot of people, if this is in fact some bug issue.
Or you can make a bug report, but in order for that to work, many people have to vote up the problem. If that's still how they prioritize things.
Now that we have all of that out of the way....
One thing you can do to speed things up if it's database related is covered in a tutorial I wrote here: https://plus.google.com/103892214810181989328/posts/4uiSnydmhx9
Also, it's likely that HosBill is now a bit heavier since the recent update that supports PHP 7.2 - I would recommend that you upgrade your PHP to the latest version now that you can run HostBill on it. The speed is remarkably faster - quite noticeable actually, and that *might* speed up your times a bit.
Check your http error logs too, and the load on your system, etc., as well. Maybe there's a clue there why it's slowing down.
Try those first two items though, and let me know if that affords you some improvement in response time. I'm interested in hearing back on this matter.

Bradley D. Thornton - Manager Network Services, NorthTech Computer   TEL: +1.310.388.9469 (US) | +44.203.318.2755 (UK) | +61.390.088.072 (AU) | +41.43.508.05.10 (CH)
Registered Linux User #190795 - "Ask Bill why the string in [MS-DOS] function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that." - Dr. Gary Kildall.

Offline andika

  • 151
  • -1
  • Active Participant
  • ****
Re: Latest hostbill versions are slower ?
« Reply #2 on: July 05, 2018, 04:19:54 AM »
Okay, first, you do understand that things get fixed, IF they're going to get fixed, when they get fixed. Right? You can open a trouble ticket and I forget how much that costs, but then you still have to pay for the time it takes Kris to fix whatever is broken, so you might be better off just waiting for it to become a problem for a lot of people, if this is in fact some bug issue.
Or you can make a bug report, but in order for that to work, many people have to vote up the problem. If that's still how they prioritize things.
Now that we have all of that out of the way....
One thing you can do to speed things up if it's database related is covered in a tutorial I wrote here: https://plus.google.com/103892214810181989328/posts/4uiSnydmhx9
Also, it's likely that HosBill is now a bit heavier since the recent update that supports PHP 7.2 - I would recommend that you upgrade your PHP to the latest version now that you can run HostBill on it. The speed is remarkably faster - quite noticeable actually, and that *might* speed up your times a bit.
Check your http error logs too, and the load on your system, etc., as well. Maybe there's a clue there why it's slowing down.
Try those first two items though, and let me know if that affords you some improvement in response time. I'm interested in hearing back on this matter.

Thank you, I will try to update php to 7.2 version.

Offline d4f

  • 126
  • 5
  • Community Managers
  • Active Participant
  • ****
Re: Latest hostbill versions are slower ?
« Reply #3 on: July 05, 2018, 04:35:06 AM »
The described loading times sound abyssmal and may be related to some server (mis)configuration or blocked outgoing connection. While Hostbill *may* have gotten a bit slower over the years, it still loads perfectly for for me on PHP 5.6, in fact it has a much lower resource consumption that say an average Wordpress installation.

I assume you have root access to the server your Hostbill is running on. While PHP xdebug is mostly detected & blocked by ioncube, you could "strace" the PHP process of a login attempt to see what exactly it's waiting for. If for example you have a huge customer database and an active hard disk but Mysql runs on its default "8MB Ram" mode then the SQL "join" commands could take a lot of time to complete. However you should then be able to see the corresponding mysql long execution time warnings in your logs if you do monitor that as recommended.

Offline andika

  • 151
  • -1
  • Active Participant
  • ****
Re: Latest hostbill versions are slower ?
« Reply #4 on: July 05, 2018, 06:33:07 AM »
The described loading times sound abyssmal and may be related to some server (mis)configuration or blocked outgoing connection. While Hostbill *may* have gotten a bit slower over the years, it still loads perfectly for for me on PHP 5.6, in fact it has a much lower resource consumption that say an average Wordpress installation.

I assume you have root access to the server your Hostbill is running on. While PHP xdebug is mostly detected & blocked by ioncube, you could "strace" the PHP process of a login attempt to see what exactly it's waiting for. If for example you have a huge customer database and an active hard disk but Mysql runs on its default "8MB Ram" mode then the SQL "join" commands could take a lot of time to complete. However you should then be able to see the corresponding mysql long execution time warnings in your logs if you do monitor that as recommended.

This is my etc/my.cnf

[mysqld]
performance-schema=0
default-storage-engine=InnoDB
innodb_file_per_table=1
max_allowed_packet=536870912
open_files_limit=10000
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION


What's yours ?
"strace" the PHP process seems pretty complex for my knowledge, I could have done it anyway but since today it seems to run much faster, maybe it was related to cache files that need it to be built for new version.

Offline d4f

  • 126
  • 5
  • Community Managers
  • Active Participant
  • ****
Re: Latest hostbill versions are slower ?
« Reply #5 on: July 05, 2018, 11:07:09 AM »
Mysql configuration depends on three major factors, so sharing a config won't do any good:
- Hardware environment (especially RAM and whether you have an SSD)
- Whether you run MariaDB or Mysql and which version
- What kind of requests your software mostly runs

There is a simple software to get basic recommendations, run the following script as root. You need to let statistics accumulate for 12-24 hours before using it  again after restarting Mysql, otherwise the recommendations are way off.
Code: [Select]
wget -O - http://mysqltuner.pl/ | perl
Quote
seems to run much faster, maybe it was related to cache files that need it to be built for new version.
Not hostbill cache files for sure, it only caches templates which only have a sub-second performance impact.
You may be right that caching is the cause of it working faster but either Mysql or linux disk read caching then. In any case, 20-30 second delays should never happen even with blank caches.

Quote
"strace" the PHP process seems pretty complex for my knowledge
Not at all complex to strace, you do need to understand what it does though.
Make sure you have no other PHP requests (so you find the correct one), then start the login in your webbrowser.
Quickly "ps aux | fgrep php" the process and "strace -p $PIDHERE" the process to attach it to the debugger.
It will then list you the current action (probably "wait") and anything it does after.
Copy what it does in the next 50 or so lines (careful! you may have passwords in that dump!) here so I can take a look at it.

Are you using Hostbill on a bare server or with some administrative software (Plesk, cPanel, ...) below it? I really don't want to offend anyone here however it seems you are lacking a lot of slightly-more-than-basic webmaster skills.

Offline Factor

  • 44
  • 0
  • Active Participant
  • **
  • Welcome to reality wish you could stay longer..
Re: Latest hostbill versions are slower ?
« Reply #6 on: March 12, 2019, 04:57:15 PM »
I will add something Tallship posted some other place which helped me a-lot as well.

Some of the commands are examples.  depending on your os and setup.  adapt.
These are Tallships words not mine.  All the credit is his..  reprinted without permission...Grace Hopper is my Hero .  8)

The issue of the long load time is mitigated by the use of cache. One must be careful not to bring their database server to a crawl by setting unrealistic levels of cache - this isn't something that you just throw a couple of gigs, or even hundreds of MegaBytes at - think about how large your entire database is, and then upon realizing that the size of the query is rather small, proceed accordingly. Be conservative (start small and work your way up, even 10MBytes makes a *HUGE* difference in performance, so don't think you need a 500M cache okay?).


Here's what my /etc/my.cnf.d/server.cnf looks like, for the applicable entries on MariaDB 10.x:

sql_mode=""
query_cache_size = 16M
query_cache_type=1
query_cache_limit=1M
query_cache_min_res_unit = 2k


Bear in mind that even 16MBytes for cache may be waaaay more than you need. The "sql_mode" entry isn't required on MariaDB because it's already enabled by default, so it's just there for good measure and to remind me of such.

Now, here's the important part. after you put this into the appropriate my.cnf file for your particular Linux distro or UNIX variant, restart your database server:

In one console window do the following:

tail -f /var/lib/mysql/<hostname>.err


In another console, restart mysqld and watch for errors in the console where you're following the error log:


systemctl restart mysqld

If everything is good, then let's check:

mysql -uroot -p

MariaDB [(none)]> show status like 'Qcache%';

+-------------------------+----------+ | Variable_name           | Value    | +-------------------------+----------+ | Qcache_free_blocks      | 2        | | Qcache_free_memory      | 16720008 | | Qcache_hits             | 89       | | Qcache_inserts          | 43       | | Qcache_lowmem_prunes    | 0        | | Qcache_not_cached       | 4        | | Qcache_queries_in_cache | 19       | | Qcache_total_blocks     | 54       | +-------------------------+----------+ 8 rows in set (0.00 sec)

Kewl!!! Now let's hit your page in a browser.

Yes, the first query is going to be long enough for the page to render that 30 people could have lost interest thinking you're running a boyscout server and left you forever, but then go back to the home page and then hit the dedicated server product page again...

BOOM! Fricken' lightning! Pretty kewl, huh?

Now, this is important, so don't forget this part. During the time when you run your cronjob to update the inventory, the very first time someone hits your dedicated server product page, they're going to have to wait for that 30 seconds or so (One person said over two minutes), so make sure that you also include a curl or wget of that URL *After* the inventory update runs as part of that cronjob. This way, the first time anyone hits the page it will render at breakneck speed.

Not only that, but even with the modest cache settings I've included here as an example, your entire WHMCS install should fly on the second hit of any dynamic page that hasn't been updated or changed after the first HTTP request for it.

Thanks,
The Factor

Offline d4f

  • 126
  • 5
  • Community Managers
  • Active Participant
  • ****
Re: Latest hostbill versions are slower ?
« Reply #7 on: March 13, 2019, 06:10:13 AM »
It still is strongly my belief that if your Hostbill has reaction times above 0.5sec  (aka: time to first byte), something is terribly wrong with your setup.
I've seen servers with bad loading times on first visit which was later found out to be hard disks power saving (spin down) when idle or other weird behaviours for a server. Your PHP environment and server environment should always be ready to rock, this is a server and your business we're talking about, not some NAS or workstation! So no dynamic PHP FCGI for memory saving, no hard disk spin down, ....!

If that all is applied correctly and the server is not crowded, it should not even matter what Mysql caches look like. They are only relevant for huge collections or when your disks can't keep up.

That said, the post is absolutely correct saying that you should not increase query_cache_size to insane levels unless you know what you're doing. The bigger the cache, the longer it takes to look through it, the slower every single query gets. However for example for Hostbill, having it bigger than 16MB can result in good performance improvements since Hostbill queries can often be bigger than 1MB in result which would not be cached in your config.

Offline Factor

  • 44
  • 0
  • Active Participant
  • **
  • Welcome to reality wish you could stay longer..
Re: Latest hostbill versions are slower ?
« Reply #8 on: March 13, 2019, 08:41:07 AM »
@d4f. Agreed. I put it there for the OP.  Just Incase it could help in general.  It’s hard to tell wil such little info.

Thanks,
The Factor