× Here you can get community support related to ReDJ.

performance regexp in mysql

  • marcin
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago #5627 by marcin
performance regexp in mysql was created by marcin
hi,

I have noticed that ReDJ slow down my database a lot. For every request it hits a very expensive query which goes trough the whole table and execute a lot RegExp expressions. Almost one core on my server is busy only to server this load.

Of course looking for URLs mapping in the table without regexp directly comparing strings (having index on the column) would be extremely fast.

I think ReDJ should provide two modes : one using regexp for those who needs flexibility and second mode to map absolute URLs with simple string compare for those who needs performance.

Because my websites have a lot of traffic and the load ReDJ produce is an issue. I have tried to move to the standard com_redirect of Joomla which is simple and performant (simple strings with indexes in table). I could leave with less flexibility (no regular expression feature) but the huge advantage of ReDJ is I can redirect all URLs (not only not existing what is the limitation of com_redirect).

Could you please think about my concerns? I like the ReDJ a lot but I need a performance.

thanks a lot in advance
Martin

Please Log in or Create an account to join the conversation.

More
7 years 6 months ago #5631 by admin
Replied by admin on topic performance regexp in mysql
Hi,
ReDJ already has 2 modes...

www.selfget.com/forum/redj/363-is-there-kind-of-recommended-maximum-of-redirects.html
^^^^
this

www.selfget.com/forum/redj/660-any-new-development-in-the-pipeline.html
^^^^
and this

If you need to redirect a single URL use the "error redirect" feature (the query is high optimized, i.e. it uses index and only 1 row can match). Rules are intended to redirect many-2-many through regular expressions, so there is no option to use indexes...

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • marcin
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago #5634 by marcin
Replied by marcin on topic performance regexp in mysql
hi Luigi,

thanks for your answer. But I think the second mode in ReDJ has exactly the same limitation as mod_redirect - it redirects only Jommla not existing URLs, in another words only 404 errors. This does not solve my problem.

Let me explain what I mean.

I have changed many URLs in my website - mainly the hierarchy, just moving articles between categories.

Example I have moved the article from:
www.domowe-wypieki.pl/przepisy/ciasteczka/847-cynamonowe-slonce-z-ciasta-francuskiego
to:
www.domowe-wypieki.pl/przepisy/ciasta/847-cynamonowe-slonce-z-ciasta-francuskiego

so the first is invalid and the second is valid one. I need to redirect the first URL to the second. But from the Joomla point of view, both links are working. Because of Joomla "smart url logic" the first link still works and display the content, even if the URL is wrong and not valid anymore.

So I was using ReDJ to redirect such old URLs to new ones. And it works as expected (the only problem I have is database load). I have decided to go with ReDJ because the standard com_redirect does not redirect such URL which are non 404-URLs. And the same limitation (looks like) have your second mode of ReDJ. It does not redirect such URLs at all. They are even not reported as 404 because are handled by Joomla as mentioned before.

I hope now is clear what I mean that I want to have the same behaviour as the "first mode" but without regexp.

thanks in advance
Martin

Please Log in or Create an account to join the conversation.

More
7 years 6 months ago - 7 years 6 months ago #5637 by admin
Replied by admin on topic performance regexp in mysql
Hi Martin,
my question is "how many rules you currently have"?

Because for this:

Example I have moved the article from:
www.domowe-wypieki.pl/przepisy/ciasteczka/847-cynamonowe-slonce-z-ciasta-francuskiego
to:
www.domowe-wypieki.pl/przepisy/ciasta/847-cynamonowe-slonce-z-ciasta-francuskiego


You just need a single rule:
From URL: ^/przepisy/ciasteczka/
To URL: {scheme}://{siteurl}/przepisy/ciasta/{pathltrim /przepisy/ciasteczka/}{queryfull}
Request only: true (checked)

To do what you described I should add a "literal" rule feature so I could use indexes, but I would loose the "regexp" power. Unfortunately this is not planned at the moment.

Kind regards,
Luigi
Last edit: 7 years 6 months ago by admin.

Please Log in or Create an account to join the conversation.

  • marcin
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago #5639 by marcin
Replied by marcin on topic performance regexp in mysql
hi Luigi,

I have over thousand articles in my website and after migration all of them changed the URL. So I have to map all of them individually old url -> new url. I do not need regexp I need only map then as you said "literal". I think you could just simple add a global setting to switch the entire component between regexp and literal. So the same configuration screens and all would remain the same the only difference would be the component would handle the old and new urls like regexp or simple strings depends on this global setting. Could you add such configuration setting?

Another question maybe would solve my problem. Why the first URLs mapping in ReDJ component handle all URLs (existing and not existing) and the second mapping only non existing (404) ? Maybe you could enhance this second mapping (which currently is working in literal mode and handling only 404) to be also to redirect existing URLs?

thanks in advance
Martin

Please Log in or Create an account to join the conversation.

More
7 years 6 months ago #5641 by admin
Replied by admin on topic performance regexp in mysql
Hi Martin,
I mind to add the one-on-one feature extending the "error" feature, but I cannot say when it will be available.

Anyway, if your URLs changed as in your example, maybe you don't need thousand of rules for them all, just a few... have you thought about it?

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds