E107: question: time for database queries

Created on 13 Nov 2017  路  27Comments  路  Source: e107inc/e107

Hi, maybe this localhost problem or develop mode, but this time for executing queries looks too much:

image
and a bit later:

image

testing required enhancement

All 27 comments

It might also be related to the database table size...
If the table has a huge amount of records, it's slower to execute....

@rica-carv on localhost there is only one record

If it's a local machine, might be some hidden process working in the background...
Antivirus, backup, etc...
Have you tryed with a online server to see if it happens also?

That was point of question. How this is possible on localhost - other queries was normal. Just to e107_online was so slow.

Online debug looks differently (both was php7)
image

Why is on localhost looking for user_id =0 ? I am logged in.

Just guessing, but might be a localhost mysql server related issue.
It's indeed weird why in localhost your logged id is 0 and on live site is 1....

By default, only online_ip has indexing. You need to add more indexes manually. Add indexing to all the fields you use in query conditions. In your case, add indexing to online_user_id and online_timestamp.

ALTER TABLE `e107_online` ADD INDEX(`online_user_id`);
ALTER TABLE `e107_online` ADD INDEX(`online_timestamp`);

You will experience significant acceleration in case of page loading time.

@CaMer0n I think we need to add more indexes in the default SQL file (core_sql.php). Without these indexes e107 can be really slow.

If I remember correctly, I also applied these indexes when I created the e107projects.com. Node.js plugin uses the online table, and it was a bit slow.

Yes, I remembered well... my table also has extra indexes:

kepernyokep_2017-11-14_21-26-42

Thank you! Merged! 馃憤

Thank you, but you merged my other PR, not the PR for this issue. :D

haha! You're right. I should be careful when having 2 windows open. :-)

@Jimmi08 Did this fix it? For me it brings it down from 5 msec from 3 msec.

before:
image
on homepage:
image

after update:
image

on homepage:

image

Could you please provide avarage values instead of the current ones? For example "the average of 10 query times" before / after.

Btw @Jimmi08 what do you use for banchmarking query times?

@lonalore e107 firefox addon debugger analyze SQL queries

@Jimmi08 Did this fix it? For me it brings it down from 5 msec to 3 msec.

I did a quick banchmark, and unfortunately, I have to say that it's slower with indexes. Interesting... :/

Before update (avg 1,3203):
kepernyokep_2017-11-15_21-15-29

After update (avg 1,3694):
kepernyokep_2017-11-15_21-15-19

The diff is ~0,049.

Thanks @lonalore , at the least I am happy that someone else got that result too, so I'm not going crazy after all ! haha

I made new banchmark (on the same website the previous banchmarks were made on) with indexing suggested by @fwhcat on Gitter, and this is the best so far.

KEY online_ip_user_id (online_ip, online_user_id),

Results (avg ~1,261)
kepernyokep_2017-12-09_21-00-54

Thank you guys.

Thanks @lonalore and @Jimmi08. Glad I could help with that :)

@lonalore @fwhcat It appears this change has been disastrous for performance on one of the sites I manage. User tracking had to be disabled entirely. Problem appears to be with 'update' and 'delete'. I have added additional 'Mark-Time' entries to troubleshoot this.

@CaMer0n @lonalore @Jimmi08 @fwhcat Where are we on this issue? Can it be closed? Are there still issues open?

@Moc I believe it requires further testing.

Hi, after update to latest GitHub, localhost version became visibly slower. I noticed this:

image

image

@Moc I would close this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BillyBoy0823 picture BillyBoy0823  路  4Comments

chory picture chory  路  4Comments

Jimmi08 picture Jimmi08  路  3Comments

rica-carv picture rica-carv  路  5Comments

Norwayman picture Norwayman  路  3Comments