SonarQube与远程数据库太慢

时间:2014-05-02 07:52:29

标签: sonarqube

我是SonarQube的新手。我试图用SonvenQube 4.2和Maven3分析我的项目资源。

SonarQube安装在我的本地PC上,它的数据库(即MySQL)安装在远程主机上。

我执行了声纳:maven的声纳goarl,然后索引文件和质量配置文件之间的某些过程太慢(大约7分钟)。

为什么这么慢? 当MySQL与SonarQube安装在同一台主机上时,它并不慢。

有人知道如何解决这个问题吗?

■环境

  • Windows 7上的SonarQube v4.2
  • Ubuntu 12.04.4 LTS上的MySQL v5.5.37
  • Maven v3.1.1
  • JDK v1.7.0_51

■Maven的setting.xml

<profile>
        <id>sonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <!-- Example for MySQL-->
            <sonar.jdbc.url>
              jdbc:mysql://<<REMOTE_HOST>>:3306/sonar?useUnicode=true&amp;characterEncoding=utf8
            </sonar.jdbc.url>
            <sonar.jdbc.username>sonar</sonar.jdbc.username>
            <sonar.jdbc.password>sonar</sonar.jdbc.password>

            <!-- Optional URL to server. Default value is http://localhost:9000 -->
            <sonar.host.url>
              http://localhost:9000
            </sonar.host.url>
        </properties>
    </profile>

■登录

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building <<PROJECT NAME>> 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO] 
[INFO] --- sonar-maven-plugin:2.1:sonar (default-cli) @ <<PROJECT NAME>> ---
[INFO] SonarQube version: 4.2
INFO: Default locale: "ja_JP", source code encoding: "UTF-8"
INFO: Work directory: C:\<<PROJECT NAME>>\target\sonar
INFO: SonarQube Server 4.2
[INFO] [16:09:12.437] Load batch settings
[INFO] [16:09:12.806] User cache: C:\Users\<<USER>>\.sonar\cache
[INFO] [16:09:12.812] Install plugins
[INFO] [16:09:12.993] Install JDBC driver
[INFO] [16:09:13.001] Create JDBC datasource for jdbc:mysql://<<REMOTEHOST>>:3306/sonar?useUnicode=true&characterEncoding=utf8
[INFO] [16:09:17.442] Initializing Hibernate
[INFO] [16:09:24.204] Load project settings
[INFO] [16:09:24.711] Apply project exclusions
[INFO] [16:09:26.168] -------------  Scan <<PROJECT NAME>>
[INFO] [16:09:26.177] Load module settings
[INFO] [16:10:23.105] Loading technical debt model...
[INFO] [16:10:27.281] Loading technical debt model done: 4176 ms
[INFO] [16:10:27.289] Configure Maven plugins
[INFO] [16:10:27.805] Compare to previous analysis (2014-05-02)
[INFO] [16:10:27.892] Compare over 30 days (2014-04-02, analysis of 2014-05-01 15:21:24.0)
[INFO] [16:10:28.074] Deleting C:\<<PROJECT NAME>>\target\jacoco.exec
[INFO] [16:10:28.126] JaCoCo agent (version 0.6.4.201312101107) extracted: C:\Users\<<USER>>\AppData\Local\Temp\jacocoagent4016855045746382836.jar
[INFO] [16:10:28.127] JVM options: -javaagent:C:\\Users\\<<USER>>\\AppData\\Local\\Temp\\jacocoagent4016855045746382836.jar=destfile=target/jacoco.exec,excludes=*_javassist_* -javaagent:${settings.localRepository}/mockit/jmockit/0.999.8/jmockit-0.999.8.jar
[INFO] [16:10:28.371] Initializer FindbugsMavenInitializer...
[INFO] [16:10:28.387] Initializer FindbugsMavenInitializer done: 16 ms
[INFO] [16:10:28.388] Base dir: C:\<<PROJECT NAME>>
[INFO] [16:10:28.388] Working dir: C:\<<PROJECT NAME>>\target\sonar
[INFO] [16:10:28.388] Source dirs: C:\<<PROJECT NAME>>c\src\main\java
[INFO] [16:10:28.388] Test dirs: C:\<<PROJECT NAME>>\test\java
[INFO] [16:10:28.388] Binary dirs: C:\<<PROJECT NAME>>\classes
[INFO] [16:10:28.388] Source encoding: UTF-8, default locale: ja_JP
[INFO] [16:10:28.389] Index files
[INFO] [16:10:30.810] 560 files indexed
[INFO] [16:17:03.447] Quality profile for java: Sonar way
[INFO] [16:17:03.707] Sensor org.sonar.plugins.jacoco.JacocoMavenInitializer@769b92ed...
[INFO] [16:17:03.707] Execute maven plugin maven-surefire-plugin...
[INFO] [16:17:03.707] Execute org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building <<PROJECT NAME>> 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-surefire-plugin:2.7.2:test (default-cli) @ <<PROJECT NAME>> ---
[INFO] Surefire report directory: C:\<<PROJECT NAME>>\target\surefire-reports
:

谢谢,

1 个答案:

答案 0 :(得分:2)

远程主机有多远?

Sonar使用JDBC将结果上传到数据库。当通过WAN链路运行时,该协议效率非常低,导致Sonar运行时间非常长。