Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33482

WolfSSL's math is unnecessarily slow

Details

    Description

      The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate (MDEV-31856)

      Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

      There are different build options to speed up math, including assembly optimizations.
      Interesting ones are

      • WOLFSSL_SP_MATH_ALL ("new" math library, they promote now as being faster, instead of previously hyped fastmath)
      • WOLFSSL_HAVE_SP_RSA (math optimizations for common RSA key sizes, 1024/2048/4096)
      • WOLFSSL_SP_X86_64, WOLFSSL_SP_X86_64_ASM - optimizations for Intel architecture, including assembly

      Attachments

        Issue Links

          Activity

            wlad Vladislav Vaintroub created issue -
            wlad Vladislav Vaintroub made changes -
            Field Original Value New Value
            Description The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be !image-2024-02-17-13-37-02-040.png|thumbnail! , with 93% or the time spent _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate.

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be !image-2024-02-17-13-37-02-040.png|thumbnail! , with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate.

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            wlad Vladislav Vaintroub made changes -
            Attachment image-2024-02-17-13-39-02-034.png [ 73152 ]
            wlad Vladislav Vaintroub made changes -
            Description The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be !image-2024-02-17-13-37-02-040.png|thumbnail! , with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate.

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate.

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            wlad Vladislav Vaintroub made changes -
            Description The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate.

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate (MDEV-31856)

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            wlad Vladislav Vaintroub made changes -
            wlad Vladislav Vaintroub made changes -
            Description The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate (MDEV-31856)

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to overcome
            The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate (MDEV-31856)

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to speed it up.
            wlad Vladislav Vaintroub made changes -
            Description The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate (MDEV-31856)

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different options to speed up math (including assembly optimizations), that can be used to speed it up.
            The most visible effect is the server startup on Windows in 11.4, which is now 10 times slower than it used to be, with 93% or the time spent in _CheckProbablePrime, coming from wolfssl_EVP_PKEY_keygen , that is used to generate private key, that is used to generate self-signed server SSL certificate (MDEV-31856)

             !image-2024-02-17-13-37-02-040.png|thumbnail!

            Also, establishing an SSL connection is relatively slow, because of the same reason, WolfSSL large number math, and prime calculations.

            There are different build options to speed up math, including assembly optimizations.
            Interesting ones are
            * WOLFSSL_SP_MATH_ALL ("new" math library, they promote now as being faster, instead of previously hyped fastmath)
            * WOLFSSL_HAVE_SP_RSA (math optimizations for common RSA key sizes, 1024/2048/4096)
            * WOLFSSL_SP_X86_64, WOLFSSL_SP_X86_64_ASM - optimizations for Intel architecture, including assembly



            wlad Vladislav Vaintroub made changes -
            Attachment screenshot-1.png [ 73154 ]

            This is VTune profile of the started, of the applied fix with WOLFSSL_SP_MATH_ALL / WOLFSSL_HAVE_SP_RSA / WOLFSSL_SP_X86_64_ASM . It is now approx 10x faster, and one can even see avx2 optimizations.

            wlad Vladislav Vaintroub added a comment - This is VTune profile of the started, of the applied fix with WOLFSSL_SP_MATH_ALL / WOLFSSL_HAVE_SP_RSA / WOLFSSL_SP_X86_64_ASM . It is now approx 10x faster, and one can even see avx2 optimizations.
            wlad Vladislav Vaintroub made changes -
            issue.field.resolutiondate 2024-02-18 12:12:41.0 2024-02-18 12:12:40.792
            wlad Vladislav Vaintroub made changes -
            Component/s SSL [ 10112 ]
            Fix Version/s 10.5.25 [ 29626 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 10.6.18 [ 29627 ]
            Fix Version/s 10.11.8 [ 29630 ]
            Fix Version/s 11.0.6 [ 29628 ]
            Fix Version/s 11.1.5 [ 29629 ]
            Fix Version/s 11.2.4 [ 29631 ]
            Fix Version/s 11.3.3 [ 29632 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 11.5.1 [ 29634 ]
            Fix Version/s 11.3.3 [ 29632 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 11.5.1 [ 29634 ]

            People

              wlad Vladislav Vaintroub
              wlad Vladislav Vaintroub
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.