Help required to analyse why site is very slow to use

Just a quick observation:
The contacts query returns over 2000 records
image
but the platform says 509 companies found:

That’s without any filters applied. Is there more you can filter in the query on the server that the page doesn’t need?

I am also getting some files missing that also impacts on load times:

Invoke-WebRequest -Uri "https://daviesandgray.co.uk/admin/_admin_library__201029.php" -Headers @{
"Pragma"="no-cache"
  "Cache-Control"="no-cache"
  "sec-ch-ua"="`"Chromium`";v=`"88`", `"Google Chrome`";v=`"88`", `";Not A Brand`";v=`"99`""
  "sec-ch-ua-mobile"="?0"
  "User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"
  "Accept"="*/*"
  "Sec-Fetch-Site"="same-origin"
  "Sec-Fetch-Mode"="cors"
  "Sec-Fetch-Dest"="empty"
  "Referer"="https://daviesandgray.co.uk/admin/admin_library_old"
  "Accept-Encoding"="gzip, deflate, br"
  "Accept-Language"="en-US,en;q=0.9,es-ES;q=0.8,es;q=0.7"
  "Cookie"="PHPSESSID=nm36bbt3okedh4vqsm5c6thtb6; login_sec=izozC3g0zFEiIoPQgFISHpSIvRfL5QxlkSQmUcB0d1yHj3mjHmfdnhv2zoFY5pX9SLLL6j1HWucddKF%2BGnS96w%3D%3D"
  "dnt"="1"
}

Hey @UKRiggers

I’ve not had a chance to play with your app, but I expect we are in a similar place in terms of size of app and performance. I know I’m skirting the edges of when the user’s machine starts to slow down at times.

I’d love to see some clear documentation on how to use Wappler to create speed efficient sites with good examples.

The simple thing I am learning is to push as much work onto the server as possible. In particular with regard to the data you request to display.

For example, I have situations where I am displaying event attendees and messages they have been sent. So it seemed sensible to go and fetch the attendees from the database, go and fetch the messages, and then use a repeat and .where() to create the table. But the repeat and .where() use a lot of the client’s resources and end up really slowing things down. So I’m moving to one database call that gets everything in one go and no .where() in the display process. It took me time to learn about all the types of join in a database query, but now I understand that then I think I have the tools to move forwards.

I’m also re-designing some of my GUI to be less based on big tables showing lots of data, and making more of the information available via a modal if someone wants to see the details.

Variables inside repeats can get really slow.

Conditional regions rather than show/hide can speed things up as they release the local resources they are using when no longer displayed. The down side is each time you go back to that region it can be slower to re-draw the page.

Look carefully at what you read in as an array. When you get your complete list of contacts, just get the info you need to display and search through them, e.g. name, email, id. Leave address, notes and all that other detailed info for when you open one specific contact. I just checked my contacts server connect and it is about 250 bytes per contact, so plenty of room for a good few 1000 without overloading things I think.

There’s probably lots more people can contribute to this…

Would love to see as many tip and tricks grouped together somewhere as possible so we can all avoid these issues in the future!

Best wishes,
Antony.

2 Likes

There is a thread with a lot of performance related issues on that I started and I know @patrick contributed to… but I’ve just spent 10 minutes in various searches and can’t seem to find it! :exploding_head:

We apply a lot of ‘No Auto Load’ to our data fetching and only load upon a request by the user, on a click, certain action or combined action. Pages load super fast with huge amounts of data ready to go. Caching for data that really doesn’t change a lot, and cookies and sessions for persistence. On the DB side we prepare as much we can in very efficient queries with tables that are not overly saturated with a load of non essential bloat. A few days spent tweaking your database configuration and learning about efficiency/optimisation is essential. Often overlooked by a lot of users…

My wife, for instance, loves cooking. She has hundreds of ingredients. She does not throw them all in the same pot for a meal. She takes what she needs and adds to the recipe. If I want to add ketchup I’ll do it at the table! :slight_smile:

5 Likes

As long as you don’t add it to a pizza you are safe.

Very good advices by @Antony and @Dave

2 Likes

Hahaha, or pineapple!

:smiley:

Thanks guys, all good advice. Except… I like pineapple on my pizza!

2 Likes

A man of pizza culture I see.

2 Likes

My sentiment exactly Jon!

:smiley:

Nooooooo! Hahahaha.

@UKRiggers

As someone capable of baking something like this in my domestic oven I find your comment absurdly offensive :joy:

4 Likes

Another ananasophobic added to my black book.

3 Likes

Ooh, that just needs a bit of pineapple and some ketchup and I think you’ll have a winner :+1: :joy:

If I knew how to say it and knew what it meant (quickly Googles!) then I might disagree with you :smile:

Some very harsh comments on here today :rofl:

2 Likes

My type of Pineapple!

2 Likes

Dare I be a real bore and bring us back to the topic at hand? (no, not :pineapple:)…

Some questions come to mind:

  • What is the best way to see how much memory the browser is using to run our app?

  • How do we know that number is near the limit?

  • How much of a difference will it make if lots of other tabs are open and other apps running on the computer being used? Can we easily see what are the best things to close to give our app more room to breathe?

  • Are some browsers more memory/resource efficient for a typical large Wappler SaaS app and therefore better to recommend our clients to use?

Don’t underestimate yourself! Real bore? More like a pizza party pooper!

I believe it would be even better if you start a new topic as those questions deserve a topic and a huge discussion.

3 Likes

:rocket: DONE :rocket:

1 Like

I’m hearing quite often here problems that developers are having that seem to indicate that they don’t have querying database experience. Which is HUGELY important to optimizing data dependent apps.

Today’s databases have ENORMOUS power & speed to process complicated views, tables, comparisons, sorts, joins using conditionals far faster & reliable that handing these app requirements off to a million different User device environments.

Having started in PHP and MySQL years ago I am surprised that people are trying to make a user’s browser process traditionally server actions ON-THE-FLY when the user’s data bandwidth or IP connection and model of phone device and version of browser and on-board cache is assigned to the App if it is mobile, etc.

When even node apps can connect to a php/mysql stack for querying data more queries should be written to allow today’s version of mysql or nosql varieties to on-the-server set up the tables & views.
Typically, on an adequate host the database serves up EVERYTHING in milliseconds, including 3 or 4 or 5 table joins with conditional filters.

On your database server, as you know, you can define common queries that sit already cached without requiring your user’s devices to process anything but to filter for displays.

How many are using this Wappler-advised Goodie?

Then open the State Management category. In this tutorial we will show you how to cache the data in the local storage, but you can also store it in a session if you like. So - we select local storage manager:
https://docs.wappler.io/t/caching-api-data/3671

For SQL queries (depending on host database installation some of these tips will be invalid – not work or deliver promised improvement.
https://www.winwire.com/25-tips-to-improve-sql-query-performance/

Sometimes i’ve handed off complex queries to a Query Expert, such as listed on the Freelance-for-hire sites. A good query expert can come up with alternative views which I save as Custom Queries. I save myself hours & hours of noodling around trying to build a particular query where I am completely ignorant about the “magic” ways a Query professional can tackle my problem and get a ridiculously fast result.

7 Likes

We do the same. Tools for jobs. If you’re going to do it properly do it properly in the right way with the right tool and if that requires external intervention by an expert all the better for your application.

Great reply @NewMedia (wish I could like it twice).

1 Like