LOOK AT https://www.google.com/search?q=how+to+find+out+from+logs+if+max_connection_errors&sca_esv=b1f7e2cc7f09216f&sxsrf=AE3TifM8aSm7L3XAYf5HdCRWnv8rRUIDHw%3A1760953512982&ei=qAT2aNDfO6a4i-gPru6J0Aw&ved=0ahUKEwjQ0-2Ev7KQAxUm3AIHHS53AsoQ4dUDCBE&uact=5&oq=how+to+find+out+from+logs+if+max_connection_errors&gs_lp=Egxnd3Mtd2l6LXNlcnAiMmhvdyB0byBmaW5kIG91dCBmcm9tIGxvZ3MgaWYgbWF4X2Nvbm5lY3Rpb25fZXJyb3JzMgoQIRigARjDBBgKSOQwUMQIWOwmcAF4AZABAJgB-QKgAY1AqgEGMi0yMC45uAEDyAEA-AEBmAIDoAKuBMICChAAGLADGNYEGEeYAwCIBgGQBgiSBwUxLjAuMqAHlIYBsgcDMi0yuAelBMIHBTAuMS4yyAcL&sclient=gws-wiz-serp





You can scale up your max_connections just fine. Put a line like

max_connections=250

in your MariaDB my.cnf file. But don't just set it to a very high number; each potential connection consumes RAM, and with only 8GiB you need to be a bit careful about that.

If you give this command you'll get a bunch of data about your connections.

SHOW STATUS LIKE '%connect%';

The important ones to watch:

  • Connection_errors_max_connections The number of connection attempts that failed because you ran out of connection slots.
  • Connections The total number of connections ever handled
  • Max_used_connections The largest number of simultaneous connections used.
  • Max_used_connections_time The date and time when the server had its largest number of connections.

The numbers shown are cumulative since the last server boot or the most recent FLUSH STATUS; statement.





INTEROGATING process list - below shows the no connections in use


SELECT db, COUNT(db) FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY db











Always check the localhost.log for the word connections



In multiTenantConnectionProvider - turn hibernate statistic on:


lSettings.put("hibernate.generate_statistics","true");


also add hikari leak threashold in not already in


lSettings.put("hibernate.hikari.leakDetectionThreshold","10000");


can also reduce the no of connection so easier to trigger the issue


 lSettings.put("hibernate.hikari.minimumIdle""1");

        // Maximum number of actual connection in the pool

        lSettings.put("hibernate.hikari.maximumPoolSize""10")


In logback ensure logging hibernate stats and hikari


    

      

    <appender name="HIKARI"  class="ch.qos.logback.core.rolling.RollingFileAppender">

        <file>${LOG_HOME}/hikari.log</file>

            <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">

                  <fileNamePattern>${LOG_HOME}/hikari.%d{yyyy-MM-dd}.%i.log</fileNamePattern>

                  <maxFileSize>10MB</maxFileSize>

                  <totalSizeCap>5GB</totalSizeCap>

                  <maxHistory>20</maxHistory>

              </rollingPolicy>

              <layout class="ch.qos.logback.classic.PatternLayout">

                    <pattern>[%-5level] -%d{yyyy-MM-dd HH:mm:ss:SSS} -%X{tenant} - [%X{IP}] - %c{2}:%L - %m%n</pattern>

              </layout>

    </appender>

 

      <logger name="com.zaxxer.hikari" level="ALL" additivity="false">

        <appender-ref ref="HIKARI" />

    </logger>

    

        <appender name="HIBERNATE"  class="ch.qos.logback.core.rolling.RollingFileAppender">

        <file>${LOG_HOME}/hibernate.log</file>

            <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">

                  <fileNamePattern>${LOG_HOME}/hibernate.%d{yyyy-MM-dd}.%i.log</fileNamePattern>

                  <maxFileSize>10MB</maxFileSize>

                  <totalSizeCap>5GB</totalSizeCap>

                  <maxHistory>20</maxHistory>

              </rollingPolicy>

              <layout class="ch.qos.logback.classic.PatternLayout">

                    <pattern>[%-5level] -%d{yyyy-MM-dd HH:mm:ss:SSS} -%X{tenant} - [%X{IP}] - %c{2}:%L - %m%n</pattern>

              </layout>

    </appender>

 

 

    <logger name="org.hibernate" level="TRACE">

        <appender-ref ref="HIBERNATE" />

    </logger>