These are chat archives for mirumee/saleor

1st
Jul 2018
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 08:20
That's quite weird https://i.imgur.com/ADuwQKW.png
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:34
@Pacu2 okay thank you
does anyone know why it took so much time in the idle process?
I ve tried to load the template first and then do some ajax call later, and it seems it took so much time in preloading page rather than processing the python script.
image.png
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 08:39
@YunazGilang is CREATE_IMAGES_ON_DEMAND set to false?
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:43
@NyanKiyoshi I haven't set it. does it should be set? it is set in the env variable right?
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 08:43
Yes, try setting it to false, it may be one of the causes
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:49
@NyanKiyoshi I have tried to set it to False, but its the same
image.png
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 08:51
You should have a debug menu at the right top of your frontstore pages. Try to see if you can find the cause in the menu (e.g.: heavy/ slow SQL requests)
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:53
yes, it is shown like this
image.png
Ousmane Seidy Diallo
@TheBlackDude
Jul 01 2018 08:53
@NyanKiyoshi @Pacu2 Thanks, it was the __pycache__ folder
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:54
@NyanKiyoshi , i guess the SQL request pretty fine, but all the elapsed time took so long. Any suggestion?
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 08:54
Server side?
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:55
hmm.. what? @NyanKiyoshi
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 08:56
Look at the SQL entry of the debug panel, 213 requests, your requests are not optimized
It's the source I would guess
That's a huge difference which hangs the app
https://i.imgur.com/U7HTAW4.png
The timing from the SQL doesn't count the handling/ parsing from the django ORM
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 08:59
ah, i see. I use raw query in some cases to match with my modified database. But this query which duplicated the most is not from my raw query.
image.png
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 09:01
You are not using migrations?
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 09:03
migrations for what? i have done python manage.py makemigrations and execute python manage.py migrate
@NyanKiyoshi this seems to call a query to database each time, resulting in many duplicate.
image.png
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 09:06
For your changes, it sounded like you were editing manually the database through raw SQL. That's good then.
You should try to review your SQL requests and look for ways to get the most data you can in one request (through JOIN statements, A.K.A. prefetch in django ORM) and make sure all the constraints and indexing are optimized for your case and statements.
It's the menu requests, it's not really optimized but acceptable. It's already planned to review this issue
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 09:09
hmm.. so how can i find the bloated request that slows down my page load time?
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 09:09
You should look into your own code changes, the stock version of Saleor makes around 29 SQL queries to view a product. Your changes make it 215
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 09:38
@NyanKiyoshi ah yes, it seems like the culprit is in my raw query. I have solved some so it become less.
image.png
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 11:43
@NyanKiyoshi what's that for?
Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 11:50
I have removed most of the duplicates SQL queries as much as I can. But i guess it still pretty slow
image.png
NyanKiyoshi
@NyanKiyoshi
Jul 01 2018 17:34

A question about SEO that bothers me a little: SEO wise, we should redirect the moved link to the new link to avoid dead links.
That's the case for categories, products, etc. in Saleor as we get the object from the passed PK in the url. But not the case of pages as we don't pass any PK.

So the question is: should we add a PK to the page url to prevent dead links (and in the meantime, improve SQL timings of course since we are getting by PK)? (/page/<slug>-<pk>/)
Or would it be an unwanted pattern?

There are other solutions of course at the model side. I would like to have some feedback on that one. (could also be /page/<pk>/<slug>/ which could look better, and is a correct SEO pattern as well)

Yunaz Gilang Ramadhan
@YunazGilang
Jul 01 2018 18:10
@NyanKiyoshi i think /page/<pk>/<slug>/ looks better
Anyway, from my previous problem i found out that removing some panel in Django Debug Toolbar makes it faster in page loading
image.png