1. 14

For the past day or two it’s not uncommon for a page to load up to a minute for me. Refreshing rarely helps.

What’s happening?

  1.  

  2. 12

    During the host migration we moved off of MariaDB to managed MySQL. That introduced a change in our query plans which is causing most of the slowness.

    1. 2

      The biggest thing I notice is that sometimes where’s a 20 to 50 second delay in loading something. For example, when I loaded the frontpage just now it took about 30 seconds. I also had it when loading some stories the other day (I loaded two in a tab, both took this long). The browser is just waiting on a reply from the server. Everything else seems unchanged, and this is just occasionally (it’s okay now).

      I don’t know if that’s related to the SQL query plan issues, but my first instinct would be to say it’s not(?)

    2. 5
      1. 3

        Anecdata: maybe dependent on time of visit, for me it feels quicker since the move (except the search, which is “slow” as it always was)

        1. 1

          See this Github issue, which proposes a fix the the slow search: https://github.com/lobsters/lobsters/issues/950

          It has not been picked up by a maintainer, but I just want to raise awareness.

        2. 1

          The page ist still quick for me, maybe quicker than before. Site search took quite long, I noticed.

          1. 1

            I think I just killed it a minute or so ago by trying to search for:

            Url is an unseen domain from a new user

            Whoops :) Sorry!

            1. -1

              Ruby.

              1. 7

                More Rails. Ruby is on average a bit faster than some of its competitirs (other than node.js for example and depending on the benchmarking of course), just Rails does quite a bit of stuff that other frameworks in other languages don’t do. A lot of it is for b get subtle “magic” and making things look “nicer” (closer to human language, etc.)

                Not a Ruby programmer myself, but looked into that once a couple of years ago.

                1. 11

                  I disagree with this assessment. I have been involved in building a competitor to Rails based on Sinatra (Padrino). The speed of Rails is less informed by its “fancyness” - this used to be the case, when it used a number of Ruby features that were badly optimized. This has changed nowadays.

                  A lot of Rails “slowness” comes from being very proper around HTTP. For example, Rails always runs with a full security stack and is pretty aggressive around that. That’s not only the frontend, but also the render engine, etc. Many frameworks that benchmark well against Rails actually do so by making security “optional”. (FWIW, Sinatra is somewhere in the middle, it always runs with rack-security, but doesn’t default to output escaping, at least last time I checked). Quotes for “optional” as security against attacks that are well understood and happen in an automated fashion on the internet is bad. There is an amount of Rails running things you may not need by default, so you can optimise there.

                  As mentioned above, the problem seems to be differences between MariaDB and MySQL. Ruby has nothing to do with this, but everyone who sees software written in Ruby buys into that meme. It’s annoying and honestly not something I find okay in an engineering forum.

                  1. 1

                    but doesn’t default to output escaping, at least last time I checked

                    Care to elaborate on that?

                    1. 1

                      Sure. So, there’s a problem in templating, which is that in HTML, you need to be very careful about what strings you put into it. The problem is “cross-site-scripting” (XSS). Someone could inject a JavaScript tag into your document, which can do all shenanigan within the context of the page. A mitigation against that is to escape HTML tags in strings before putting that into the output buffer. In Rails and many Ruby frameworks, this works through a special kind of buffer called SafeBuffer.

                      SafeBuffer + String gets the String escaped. SafeBuffer + SafeBuffer does nothing, String + SafeBuffer does, if I remember right, not work. String has a method to turn it into SafeBuffer, in case you want it to not escape.

                      This is all very efficient, as SafeBuffer is essentially just a small wrapper on top of the actual buffer.

                      Most Rust template libraries punt on the issue (as Ruby did before, for a long time).

                2. 1

                  More Rails. Ruby is on average a bit faster than some of its competitirs (other than node.js for example and depending on the benchmarking of course), just Rails does quite a bit of stuff that other frameworks in other languages don’t do. A lot of it is for b get subtle “magic” and making things look “nicer” (closer to human language, etc.).