Loading


Advertisement:

Author Topic: Osclass speed  (Read 472 times)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Osclass speed
« on: July 20, 2017, 10:45:51 am »
Is it true that if you use many plugins and new functionalities other than the ones included in the initial script, your site speed decreases?

I was thinking about, for example, sorting the aditional fields. But for that I would need a new object in which to put those fields and then sort them.
In the same way, every new functionality or existing functions calls increases the time for the script to be executed (and memory load) and decreases speed.

Am I right?

This is why osclass is so lite, as I've read in some posts here?

And This is also why I've saw some people complaining about speed issues @ 200.000 ads?

Aficionado

  • issues
  • Hero Member
  • *
  • Posts: 5296
  • Hardliner
Re: Osclass speed
« Reply #1 on: July 20, 2017, 01:23:35 pm »

This is why osclass is so lite, as I've read in some posts here?

And This is also why I've saw some people complaining about speed issues @ 200.000 ads?

Osclass is not so light as you may think.

Also those "complainers" they have never posted any link and they worry about their site COULD reach 200.000 ads in the next 10 years. I mean with those numbers, you have already taken care of your problems with a proper server and caching.

« Last Edit: July 20, 2017, 01:25:33 pm by Aficionado »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Re: Osclass speed
« Reply #2 on: July 20, 2017, 02:14:55 pm »
I saw it's not so light, but every new functionality adds to it.

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4690
Re: Osclass speed
« Reply #3 on: July 20, 2017, 02:54:34 pm »
Everything you add, will make your website slower, it's simple and not only for Osclass, but for any program out there. You are doing more, calculating more so it would take more time. Sounds logic, right? Well, not so fast. There are a few things to have in mind:

"Compute power" (your server's CPU) is VERY fast, you could execute more functions, compute more things and it will be fast, you could add plugins and new features and you will not see any difference in load times or speed (your site will be a little tiny bit slower, like a few micro-seconds slower, hey! you are doing more work than before!).

Database queries. You could do more work (at almost the same speed), but you need data, information. You get that from the database and that's "expensive", that takes A LOT (some milliseconds is a lot in computer speed) of time (because they need to write/read information from the disk). If this new features do a lot of database queries, then your website will be "considerably" slower (a few ms). As your website grows in users, listings and other things, it will became slower, even if you don't add any new feature, because you are reading and writing more to the database.

TLDR: It's your database which (probably) makes your website slower

Now, with nowadays servers, you (probably) don't have to worry about Osclass being slow. We know about some sites with 700-800k listings , > 1million users work fine with Osclass in a "regular" high end server (nothing too strange). Of course, it's not your normal VPS and it may cost you a few thousands $$$ per month to run that server, but that's something that will happen with our without features.









marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Re: Osclass speed
« Reply #4 on: July 20, 2017, 03:18:36 pm »
That's what I tought. Thank you for the infos.

And another thing. I was discussing this with a friend.
Wich would be faster on the same server and a considerable amount of visitors?:
A. ft_min_word_len=1
or
B. ft_min_word_len=4 + my hack with the underlines for under 4 character words (ex. a___ ab__ abc_)

Both with Teseo's wildcard for searching: the search "chair" returning "chair" and "chairs" as results. ( in the B option the wildcard works only for min 4 characters words).

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 1829
  • osclass.work
Re: Osclass speed
« Reply #5 on: July 20, 2017, 03:46:18 pm »
Option A, simply because of less code.

Additionally, smaller database size, and full compatibility with some plugins.
« Last Edit: July 20, 2017, 06:07:31 pm by dev101 »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Re: Osclass speed
« Reply #6 on: July 20, 2017, 08:54:15 pm »
Option A, simply because of less code.

Additionally, smaller database size, and full compatibility with some plugins.

I agree with you on words >=4 characters.
But what about in the case of searching for 1, 2 or 3 character words with wildcard on?

More php string handling functions will slow less or more the execution than the search query with wildcard?

(I ask because I don't know, not to show off)

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4690
Re: Osclass speed
« Reply #7 on: July 20, 2017, 09:03:10 pm »
LIKE '%pattern%' is a really bad idea in performance terms

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Re: Osclass speed
« Reply #8 on: July 20, 2017, 09:28:50 pm »
LIKE '%pattern%' is a really bad idea in performance terms

Which is a bad idea? The query with wildcard  and ft_min word_len=1, or the other one?

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4690
Re: Osclass speed
« Reply #9 on: July 21, 2017, 12:21:42 am »
If for "wildcard" we understood doing what I wrote before (LIKE '%....%' ) then, it's a bad idea.  First because wildcards are expensive (slower), you are doing it in a big field (type TEXT) which is again, slower. Also, with wildcards you match the whole sentence, if it's a word there's no difference, but if you search for two or more, the it has to match the exact same sentence. For example, is you search for "a b c" it will match only listings with "a b c" but not with "b a c" for example. And all results have the same priority, that's it doesn't matter if a word appear once or multiple times in a listing (more info later)

The current search (with MATCH () AGAINST) is using what is called "FULLTEXT", fulltext is like magic, it allows a more "natural" search, for example synonyms, misspelled words, plurals,... it takes in consideration proximity of words, for example if you search for "red car" a listings about "red car" will have more relevance than one about "red riding hood driving a yellow car", or how often it appears in the listings. If it appears multiple times, it's consider more relevant and it only appears once. It allows you to use some other magic, like using "-" to avoid words, for example "car -yellow" with return listings abouts cars that doesn't contain yellow in the text.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 1829
  • osclass.work
Re: Osclass speed
« Reply #10 on: July 21, 2017, 04:11:49 am »
LIKE is slower, but in some cases a desireable mode, it all depends on a project. If you have a small project, and a solid server, with reasonable traffic, it may just work well. In large systems it will be prohibitively expensive to use. But, I don't think this was the question above.

According to my custom tests done couple of years ago, using a wildcard in FULLTEXT mode (*) is not adding up virtually anything to performance***, but it affects search results. In some cases, it will return/have desirable effect, but if a user expects exact match, it will have a counter-intuitive effect, returning more irrelevant results. This is all fine if we have a reasonable number of results, but imagine 10k results, it may be very frustrating thing for users. It is hard to have a good search without using relevance sorting, which, sadly, Osclass does not use and FT algorithm supports it. Once I opened an issue @ github about this (edit: actually, it was opened by another member, I just added a followup comment), but it was closed, which is not good imho, because support in the core is badly needed for it. Current 'hacks' provided by teseo are not 100% compatible with some internal things (there are like 10 versions of mods, and some are very ugly, and not perfect either).

About ft_min word_len=1, this is a bad idea. I did not do a more recent tests with newer SQL versions and servers, but back when I did with limit of 2, searching for x* was 30 times slower than xy*. Granted, more results were matched and all, but do you really can answer how much of it was actually relevant? The shorter the string is, the more results will be collected, and it will be much slower.

it takes in consideration proximity of words, for example if you search for "red car" a listings about "red car" will have more relevance than one about "red riding hood driving a yellow car", or how often it appears in the listings. If it appears multiple times, it's consider more relevant and it only appears once.

Conejo, unfortunately, Osclass does not use relevance ordering as of now in titles/descriptions. SQL queries in the core are not built to take those values in sorting. As I tried to explain above, outside mods can be used, but they mess up things with languages, alerts etc. because there is no official support for it.

Mind you, relevance itself will slow things down because of a more complicated search.



*** using some normal word length e.g. >3
« Last Edit: July 21, 2017, 04:49:10 am by dev101 »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Re: Osclass speed
« Reply #11 on: July 21, 2017, 08:45:48 am »
de1v01, that's why I asked. Thank you.
From my limited experience and the infos from here, I think my case is the best I could choose (ft_min_word_len=4 and the underlines because searching for 1 character word is essential)
In time, if the site grows, i'll remove the wildcard from teseo's solution (results with all the words inCluded , so with "logical" &&  not || )

EDIT This is theseo's wildcard

Code: [Select]
           $query_elements['sPattern'] = str_replace($word, '+' . $word . '*', $query_elements['sPattern']);
           // $query_elements['sPattern'] = str_replace($word, '+' . $word, $query_elements['sPattern']);

and his post https://forums.osclass.org/general-help/search-result-must-show-only-those-ads-that-contain-all-words-given-in-the-searc
« Last Edit: July 21, 2017, 09:44:48 am by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 927
Re: Osclass speed
« Reply #12 on: September 13, 2017, 02:48:22 pm »
Is it true that if you use many plugins and new functionalities other than the ones included in the initial script, your site speed decreases?

I was thinking about, for example, sorting the aditional fields. But for that I would need a new object in which to put those fields and then sort them.
In the same way, every new functionality or existing functions calls increases the time for the script to be executed (and memory load) and decreases speed.

Am I right?

This is why osclass is so lite, as I've read in some posts here?

And This is also why I've saw some people complaining about speed issues @ 200.000 ads?

It is possible to sort alphabetically the aditional fields with sql ORDER BY name ASC  functionality when the fields are selected from the DB? This will eliminate the need of 2 objects. Am I right?
« Last Edit: September 13, 2017, 02:50:50 pm by marius-ciclistu »