Skip to content

Schema loading performance regression after update from rails 5.1 to rails 5.2 #1720

@sudoremo

Description

@sudoremo

Steps to reproduce

Background is that we're experiencing massive performance issues since updating to rails 5.2. Looking at the logs, it seems that structural database statements make the difference. To isolate this, we performed db:cache:dump multiple times, both with rails 5.1 and rails 5.2.

The difference is startling (see next 2 sections).

This may be related to #1673.

Expected behavior

Executing db:cache:dump of a large application under Rails 5.1:

unknown             :   3936 ms
Sequence            :    320 ms
Primary Key         :   9551 ms
-------------------------------
total               :  13807 ms

Corresponding statement log

The results are grouped by query type (the string before the parenthesized time in the rails log) and are the average over multiple runs.

Actual behavior

Executing db:cache:dump of the same application under Rails 5.2:

tables              :    809 ms
views               :    504 ms
synonyms            :   1987 ms
Sequence            :   6270 ms
Primary Key         : 134574 ms
Column definitions  :  30425 ms
current schema      :      6 ms
table exists        :    181 ms
unknown             :      9 ms
-------------------------------
total               : 174765 ms

Corresponding statement log

This is over 12x slower than with Rails 5.1.

System configuration

Rails version: 5.1 / 5.2

Oracle enhanced adapter version: 1.8.2 / 5.2.2

Ruby version: jruby 9.1.14.0 (2.3.3) 2017-11-08 2176f24 Java HotSpot(TM) 64-Bit Server VM 25.66-b17 on 1.8.0_66-b17 +jit [darwin-x86_64]

Oracle Database version: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

Final thoughts

As always a ton of thanks to you for looking at this and I'm sorry I couln't provide an isolated performance test – I hope that comparing the database statements of the two log files will do the trick!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions