Projects tigase _server server-core Issues #1539
Performance Optimization for stored procedure `Tig_OfflineMessages_AddMessage` and `last_insert_id` (#1539)
wojciech.kapcia@tigase.net opened 3 months ago

Reported by @davide.1 (https://github.com/tigase/tigase-server/issues/229):

The stored procedure Tig_OfflineMessages_AddMessage is using SELECT LAST_INSERT_ID() AS msg_id; which causes a performance issue. For example, on Aurora RDS, this command leads to a significant amount of "wait/io/redo_log_flush". Would it be possible to eliminate this call and check in another way if the message was successfully inserted into the table?

Since the code only checks if the return value is different from zero, it should be sufficient to replace it with select 1 as msg_id. In any case, if there is a problem with the insert, the stored procedure will throw an exception. What do you think?

wojciech.kapcia@tigase.net added to iteration "tigase-server-8.5.0" 3 months ago
wojciech.kapcia@tigase.net added "Related" #1252 3 months ago
wojciech.kapcia@tigase.net referenced from other issue 3 months ago
wojciech.kapcia@tigase.net added "Related" Customers/catapush-s-r-l#35 3 months ago
Davide Marrone commented 3 months ago

I have changed to stored procedures: Screenshot 2024-08-23 at 10.03.13.png

but it seems that there is no great improvements on Aurora RDS, in the past when I seen a big improvement was because we was on standard Mysql not Aurora and there the improvement was significant. But now Aurora already optimize a lot the disk access with their own disk infrastructure so there there is almost no difference. I think that the "wait/io/redo_log_flush" is simple attached from "Performance insights" to the latest executed query but that does not mean that the problem is that query, the "problem" is the total stored procedure with high traffic.

tot.png

so in the end I think it still a good idea to remove the unused values but is beneficial only for standard Mysql and not for Aurora Mysql

wojciech.kapcia@tigase.net commented 3 months ago

Thank you for the update

issue 1 of 1
Type
Performance
Priority
Normal
Assignee
Version
none
Sprints
n/a
Customer
n/a
Iterations
Issue Votes (0)
Watchers (4)
Reference
tigase/_server/server-core#1539
Please wait...
Page is in error, reload to recover