Discussion Forums  >  Self Hosted Control Panels

Replies: 23    Views: 287

David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
02/07/15 03:07 AM (9 years ago)

Self-Hosted Speed: screens.php 47.002 seconds to 0.0766 seconds. WOW!

Hi self hosters. I've been hearing all sorts of "my server is painfully slow" conversations when folks load the Screens page (when working with an app). That's this file in your directory structure.... BT-server/bt_v15/bt_app/bt_screens.php I've jumped in some of the conversations, connected to all sorts of random servers in all sorts of far away lands and tuned and tuned databases until my head hurt. Tuning databases on different machines oftentime requires a few different approaches - depending on some hardware / software configurations. It's actually quite fun but gets crazy time consuming sometimes. It's especially tough to do this sort of thing when a million other fires are burning. Really? Tune somebody else's machine? Don't I have more important things to do...maybe not if the perception is "this software sucks", regardless of who's "fault" it is. BT take the heat usuall. LOL. Tune I did. I was spending some time this evening doing the same thing, got a run-of-the-mill machine running OK. It would have been acceptable. This was an install with hundreds of apps. It was almost unusable before I started tinkering. The Screens page (in app control panels) literally took FOREVER to load. On average it took over 47 seconds to load. OMG, unreal. Of course folks are freaking out. That is so badly unaccetable it kills me. Anway, I got it quite a bit faster by doing all sorts of ninja tricks. But still not fast enough - as far as I'm concerned. I got to thinking, "Hmm...if this machine is this slow, there has to be tons of other ones like it, what a pain in the ass that must be, I wonder if can make some simple changes to the script itself to try to speed things up." Of course I've thought about this a ton of times and quite few folks have tried to do the same thing in the past. Of course I knew that some machines were slow. But I also just sorta chocked it up to the "you have a cheap-ass server and need to tune your backend." department. You've all heard me say a million times how there are always multiple ways to approach things when programming and rarely is there a clearly "right" way to do things. Just differerent ways. Lots of right ways and lots of wrong ways. In this case, the screens.php page could have been written a few different ways. I chose one (a long time ago) and it worked well, mostly. Until it didn't. The until it didn't depended largely on what machine it was running on. PHP / mySQL, you'de think it would run the same everywhere, wrong. Like iOS and Android, hardware and other environment variables make a huge difference sometimes. In my case it worked well for me and my clients and can now only assume that's because I generally don't do cheap and I don't do un-tuned. I always tune a backend after it runs for a bit and as such never experienced the same slowness so many others had. I re-wrote the bt_screens.php code and IT'S 1,000 time faster on this el-cheapo-machine. No joke, that's some crazy stuff. On this install I got it from 47 seconds to less than 1 second. Unreal. It's no longer click, grab a coffee, wait for the smoke to come out of the machine, hope the browser doesn't time out, and cross your fingers. It's click, blink, it's loaded. Yes! Hmm...I put it on a few other machines, that I have NOT done any ninja trickery on and I'll be damned if it's not insanely fast on those boxes too. On one turbo machine I work with often the screens page loads in 0.0013 seconds. Now that's some software! FYI: That machine has about 233,000 rows in it's item list. Download this file. Remove the .txt extention and make it a .php extenstion. Upload it to your server (overwrite the existing file at the location I listed above). Load screens. Smile. <a href="http://buzztouch.com/test/bt_screens.txt" target="_blank" rel="nofollow">http://buzztouch.com/test/bt_screens.txt</a>
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
02/07/15 03:26 AM (9 years ago)
Sweetness!! Simply put.. Genius!!
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
02/07/15 03:38 AM (9 years ago)
WAY TO GO COOK
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/07/15 03:42 AM (9 years ago)
@Bodacious Media's avatar gets the "makes me smile the most award" every single time I see it. Funny ass cat he is (in the avatar and in real life). Good stuff.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/07/15 05:24 AM (9 years ago)
Thanks David. Installed. No issues. Things seem snappier!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/07/15 05:27 AM (9 years ago)
BTW...if this new screens.php page does NOT speed up your screens landing page, kindly post: 1) How many screens the app you're working on has confiugred (how many items show on this screen) 2) How many plugins your control panel has installed 3) The total number of apps in your control panel (estimates are fine) 4) The total number of screens across all your apps (estimates are fine) I have a hunch about some machines that this won't help and would like to figure out why some do and some don't haul ass :-)
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
02/07/15 06:10 AM (9 years ago)
David!!!!! This is Great! Im going to be clicking all day! This is going to save me a ton of time!! Thank you Thank you Thank you!
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
02/07/15 06:52 AM (9 years ago)
BOOM!!!!! Thank you David. I thought it was just me, slow, slow, slow. This is an awesome fix. FAST, FAST, FAST!!!! (Hostgator, shared, 5 apps, 1000 screens) Glad to have you back in the forums by the way. Thanks again Dave
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/07/15 07:49 AM (9 years ago)
どうもうあっりがとう! (Domo Arrigato! Thanks a lot!) Honestly, I housekeep my server more than some, and I don't have 'that' many apps with large screen counts. But that can't last forever, lol! Thanks in advance! Cheers! -- Smug
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/07/15 08:16 AM (9 years ago)
great work - wish I had it a week ago! Had just spent a couple hours digging through the code and finding a fix for someone. lol. Here was my solution: $tmp = "SELECT P.guid, P.uniquePluginId, P.displayAs, P.category, P.webDirectoryName, P.versionString, "; $tmp .= "P.shortDescription "; $tmp .= "FROM " . TBL_BT_PLUGINS . " AS P "; $tmp .= "GROUP BY P.uniquePluginId "; I basically removed the countOfScreens ordering, figuring that wasn't really important. Seemed to work for the time being, but glad to see a more official solution :)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/07/15 11:37 AM (9 years ago)
Sweet! I like fast page loading! Mark
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
02/07/15 11:47 AM (9 years ago)
The only way to do this right is to test it, hardcore. 1) I used my biggest app: ** 371 SCREENS ** 2) I have over: ** 90 PLUGINS ** 3) I have exactly: ** 98 APPS ** 4) Total screens: ** 5000 to 7500 SCREENS** (estimated) // BEFORE // It took me ** 52 SECONDS ** to load the screens.php page for my app. // AFTER // It took me LESS than ** 1 SECOND ** (INSTANT) HOLY ****! UNBELIEVABLE! ROCK ON! THANK YOU D! mrDavid
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/07/15 12:18 PM (9 years ago)
I feel like an Olympic medalist right now, hands in the air above my head fist pumping. Funny stuff
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
02/07/15 12:26 PM (9 years ago)
202 apps 48,000 bt-items screen loads in .07 seconds
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
02/07/15 12:28 PM (9 years ago)
Your a medalist in our eyes David!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
02/07/15 05:44 PM (9 years ago)
Ahhh nice!!! Extra Ninja Points!
 
Cakebit
Code is Art
Profile
Posts: 500
Reg: Dec 15, 2010
In your local b...
16,500
like
02/08/15 07:26 AM (9 years ago)
I popped my head back in to send hearty thanks to David! It's like a party over here!! *throws handfuls of confetti to hearts content* edit: And double posting prevention!!?!?! What has the world come to!?!? ;)
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
02/08/15 02:43 PM (9 years ago)
Dude! Yeah. Awesome! That's all I got. Tim
 
MadRod
Aspiring developer
Profile
Posts: 1853
Reg: Apr 12, 2012
Lisbon
27,930
like
02/08/15 04:39 PM (9 years ago)
Perfect, thats some fast loading... Cheers.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
02/08/15 09:30 PM (9 years ago)
Much, much faster. Thank you, David! This is awesome.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
02/09/15 04:32 AM (9 years ago)
This made my self hosted tons faster, i have an app with just over 5000 screens, and i tried to change it over from buzz to my self hosted, as i didn't wanna use up to much of buzz resources, before the above fix, it would transfer the app over, but left out some screens, and i could never load the screens option in self host for the above app, after the fix, it loads the screens faster than buzz(3-4 sec) self host 2-3 sec) i have query though, ive noticed when i transfer across the app, the config file is 3.3 mb, when it should be 3.7 mb, ive tried manually adding the correct size config file (changing all ID and stuff) which works at first, but soon as i press publish, it saves to the config and changes it back to 3.3 mb, cheers ps thanks for the fix david sean
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
02/12/15 11:39 AM (9 years ago)
Great stuff David! Thanks. Why do you choose php for your backend though? Is there a particular reason you prefer it over other scripting languages?
 
ridgerock
Veteran developer
Profile
Posts: 183
Reg: May 19, 2011
Louisville
1,830
like
07/16/15 12:36 PM (8 years ago)
Holy Crap! How did I just find this. This is a life saver. Thank You David! As always your there man.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
07/17/15 10:02 AM (8 years ago)
You know, I recently Googled this and could not find it. So was happy when you posted, @ridgerock! I edited the title of this a bit so maybe it will do better on a Google search.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.