简体   繁体   English

sonarqube 服务器的响应时间非常慢

[英]Very slow response times from sonarqube server

Running SonarQube 5.3 server and I'm having trouble with incredibly slow response times and as a result a lot of socket timeout errors from various job scanners.运行 SonarQube 5.3 服务器,我遇到了响应时间非常慢的问题,结果来自各种作业扫描器的大量套接字超时错误。 Just to give some perspective, SonarQube is running on a Windows 7 box (don't ask), so is Jenkins (in a separate instance of tomcat)只是为了给出一些观点,SonarQube 运行在 Windows 7 机器上(不要问),Jenkins 也是如此(在一个单独的 tomcat 实例中)

Response times from Jenkins: <0.1 seconds on average Jenkins 的响应时间:平均 <0.1 秒

Response times from SonarQube: 3-30 seconds, with average around 9-12 second range SonarQube 的响应时间:3-30 秒,平均约 9-12 秒范围

SonarQube is installed as a Windows service and so is Tomcat where Jenkins is running. SonarQube 安装为 Windows 服务,运行 Jenkins 的 Tomcat 也是如此。

The database server that SQ is running against is Oracle, and I really doubt that's the source of latency as the Oracle server is both fast and local... Here're the jvm opts for sq SQ 运行的数据库服务器是 Oracle,我真的怀疑这是延迟的来源,因为 Oracle 服务器既快速又是本地的......这是 jvm 选择 sq

sonar.web.javaOpts=-Xmx1536m -Xms256m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -server -Djava.net.preferIPv4Stack=true -Djruby.compile.invokedynamic=false -Dfile.encoding=UTF-8

Running on java 1.8_u45java 1.8_u45上运行

I'm kinda at a loss as I don't know how I can improve response time?我有点不知所措,因为我不知道如何改进响应时间? (Other than by maybe running it on other hardware/os.) (除了可能在其他硬件/操作系统上运行它。)

I was able to improve response time from the server greatly by doing the following:通过执行以下操作,我能够大大缩短服务器的响应时间:

  1. Restart (scheduled this daily)重启(每天安排)
  2. Schedule a process to periodically poll the server (just a shell script executing curl and logging the response time every few minutes)安排一个进程来定期轮询服务器(只是一个 shell 脚本执行 curl 并每隔几分钟记录一次响应时间)

There are still some discrepancies, which I need to analyze, but after restarting sq, the average latency went down significantly (average response in ~0.6 seconds vs. 10+), it's still a bit slow imo, but as sq is only used internally, I'm ok with it.仍然存在一些差异,我需要分析一下,但是在重新启动 sq 后,平均延迟显着下降(平均响应时间为 0.6 秒对 10+),imo 仍然有点慢,但因为 sq 仅在内部使用,我没问题。 Most importantly, none of the scanner jobs failed.最重要的是,没有任何扫描器作业失败。 Before the restart the failure rate for jobs with socket timeout was about 60%在重新启动之前,套接字超时的作业的失败率约为 60%

Perhaps you can add file to exclude to narrow down the scans.也许您可以添加要排除的文件以缩小扫描范围。

Try to exclude file that you don't need.尝试排除您不需要的文件。 https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/ https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/

Also i found scan tend to be way faster, if you disable sonar scm我还发现,如果禁用声纳 scm,扫描速度会更快

Project->Project Settings -> SCM -> Disabed the SCM sensor (checked it) Project->Project Settings -> SCM -> Disabed the SCM sensor (checked it)

sonar.scm.disabled = true sonar.scm.disabled = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM