Computing Engine does not utilize full CPU

Hi, I set up a SonarQube community edition (10.7) on a Linux Ubuntu server. During the first analysis processes, I already saw that it took very long (40+ minutes for 2M LOC). Checking the server, it turned out that the Server was basically still idle during the process (5-10% max). So I don’t understand why the scanner does not use the full CPU available for the scans and instead idle most of the time while I still wait for the process to be finished. Did I miss something while setting it up?

Architecture:             x86_64
  CPU op-mode(s):         32-bit, 64-bit
  Address sizes:          46 bits physical, 48 bits virtual
  Byte Order:             Little Endian
CPU(s):                   8
  On-line CPU(s) list:    0-7
Vendor ID:                GenuineIntel
  Model name:             Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
    CPU family:           6
    Model:                85
    Thread(s) per core:   2
    Core(s) per socket:   4
    Socket(s):            1
    Stepping:             7
    BogoMIPS:             5187.81
    Flags:                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma
                          cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap clflushopt clwb a
                          vx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_vnni arch_capabilities
Virtualization features:
  Hypervisor vendor:      Microsoft
  Virtualization type:    full
Caches (sum of all):
  L1d:                    128 KiB (4 instances)
  L1i:                    128 KiB (4 instances)
  L2:                     4 MiB (4 instances)
  L3:                     35.8 MiB (1 instance)
NUMA:
  NUMA node(s):           1
  NUMA node0 CPU(s):      0-7
Vulnerabilities:
  Gather data sampling:   Unknown: Dependent on hypervisor status
  Itlb multihit:          Not affected
  L1tf:                   Not affected
  Mds:                    Not affected
  Meltdown:               Not affected
  Mmio stale data:        Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
  Reg file data sampling: Not affected
  Retbleed:               Vulnerable
  Spec rstack overflow:   Not affected
  Spec store bypass:      Vulnerable
  Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:             Mitigation; Retpolines; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Retpoline
  Srbds:                  Not affected
  Tsx async abort:        Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown

{
    "Health": "GREEN",
    "Health Causes": [],
    "System": {
        "Server ID": "FAA8123E-AZJ3BH7nP4MU2C8MUL32",
        "Version": "10.7.0.96327",
        "Edition": "Community",
        "Lines of Code": 1622642,
        "Container": false,
        "High Availability": false,
        "Official Distribution": true,
        "Force authentication": true,
        "Home Dir": "/home/sonar/sonarqube-10.7.0.96327",
        "Data Dir": "/opt/sonarqube/data",
        "Temp Dir": "/opt/sonarqube/temp",
        "Processors": 8
    },
    "Database": {
        "Database": "Microsoft SQL Server",
        "Database Version": "15.00.4385",
        "Username": "Sonarqube",
        "URL": "jdbc:sqlserver:/xxxx.net:1433;connectRetryInterval\u003d10;connectRetryCount\u003d1;maxResultBuffer\u003d-1;sendTemporalDataTypesAsStringForBulkCopy\u003dtrue;delayLoadingLobs\u003dtrue;useFmtOnly\u003dfalse;useBulkCopyForBatchInsert\u003dfalse;cancelQueryTimeout\u003d-1;sslProtocol\u003dTLS;calcBigDecimalPrecision\u003dfalse;useDefaultJaasConfig\u003dfalse;jaasConfigurationName\u003dSQLJDBCDriver;statementPoolingCacheSize\u003d0;serverPreparedStatementDiscardThreshold\u003d10;enablePrepareOnFirstPreparedStatementCall\u003dfalse;fips\u003dfalse;socketTimeout\u003d0;authentication\u003dNotSpecified;authenticationScheme\u003dnativeAuthentication;xopenStates\u003dfalse;datetimeParameterType\u003ddatetime2;sendTimeAsDatetime\u003dtrue;replication\u003dfalse;trustStoreType\u003dJKS;trustServerCertificate\u003dfalse;TransparentNetworkIPResolution\u003dtrue;iPAddressPreference\u003dIPv4First;serverNameAsACE\u003dfalse;sendStringParametersAsUnicode\u003dtrue;selectMethod\u003ddirect;responseBuffering\u003dadaptive;queryTimeout\u003d-1;packetSize\u003d8000;multiSubnetFailover\u003dfalse;loginTimeout\u003d8;lockTimeout\u003d-1;lastUpdateCount\u003dtrue;useFlexibleCallableStatements\u003dtrue;useDefaultGSSCredential\u003dfalse;prepareMethod\u003dprepexec;encrypt\u003dfalse;disableStatementPooling\u003dtrue;databaseName\u003dDevOps_Sonarqube;columnEncryptionSetting\u003dDisabled;applicationName\u003dMicrosoft JDBC Driver for SQL Server;applicationIntent\u003dreadwrite;",
        "Driver": "Microsoft JDBC Driver 12.6 for SQL Server",
        "Driver Version": "12.6.3.0",
        "Default transaction isolation": "TRANSACTION_READ_COMMITTED"
    },
    "Bundled": {
        "python": "4.22.0.16914 [Python Code Quality and Security]",
        "cayc": "2.4.0.2018 [Clean as You Code]",
        "jacoco": "1.3.0.1538 [JaCoCo]",
        "kotlin": "2.20.0.4382 [Kotlin Code Quality and Security]",
        "go": "1.17.1.145 [Go Code Quality and Security]",
        "iac": "1.36.0.12431 [IaC Code Quality and Security]",
        "javascript": "10.16.0.27621 [JavaScript/TypeScript/CSS Code Quality and Security]",
        "ruby": "1.17.1.134 [Ruby Code Quality and Security]",
        "sonarscala": "1.17.1.166 [Scala Code Quality and Security]",
        "csharp": "9.32.0.97167 [C# Code Quality and Security]",
        "java": "8.2.0.36672 [Java Code Quality and Security]",
        "web": "3.16.0.5274 [HTML Code Quality and Security]",
        "flex": "2.12.0.4568 [Flex Code Quality and Security]",
        "xml": "2.10.0.4108 [XML Code Quality and Security]",
        "php": "3.38.0.12239 [PHP Code Quality and Security]",
        "text": "2.16.0.4008 [Text Code Quality and Security]",
        "vbnet": "9.32.0.97167 [VB.NET Code Quality and Security]",
        "javasymbolicexecution": "8.2.0.36672 [Java Advanced Code Quality Analyzer]"
    },
    "Plugins": {
        "communityBranchPlugin": "1.22.0 [Community Branch Plugin]"
    },
    "Web JVM State": {
        "Max Memory (MB)": 512,
        "Free Memory (MB)": 66,
        "Heap Committed (MB)": 237,
        "Heap Init (MB)": 128,
        "Heap Max (MB)": 512,
        "Heap Used (MB)": 169,
        "Non Heap Committed (MB)": 164,
        "Non Heap Init (MB)": 7,
        "Non Heap Used (MB)": 158,
        "System Load Average": "0.0% (last minute)",
        "Threads": 40
    },
    "Web Database Connection": {
        "Pool Total Connections": 12,
        "Pool Active Connections": 1,
        "Pool Idle Connections": 11,
        "Pool Max Connections": 60,
        "Pool Min Idle Connections": 10,
        "Pool Max Wait (ms)": 8000,
        "Pool Max Lifetime (ms)": 1800000
    },
    "Web Logging": {
        "Logs Level": "INFO",
        "Logs Dir": "/home/sonar/sonarqube-10.7.0.96327/logs"
    },
    "Web JVM Properties": {
        "catalina.base": "/opt/sonarqube/temp/tc",
        "catalina.home": "/opt/sonarqube/temp/tc",
        "catalina.useNaming": "false",
        "com.zaxxer.hikari.pool_number": "1",
        "file.encoding": "UTF-8",
        "file.separator": "/",
        "http.nonProxyHosts": "localhost|127.*|[::1]",
        "java.awt.headless": "true",
        "java.class.path": "./lib/sonar-application-10.7.0.96327.jar:/home/sonar/sonarqube-10.7.0.96327/lib/jdbc/mssql/mssql-jdbc-12.6.3.jre11.jar",
        "java.class.version": "61.0",
        "java.home": "/usr/lib/jvm/java-17-openjdk-amd64",
        "java.io.tmpdir": "/opt/sonarqube/temp",
        "java.library.path": "/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib",
        "java.runtime.name": "OpenJDK Runtime Environment",
        "java.runtime.version": "17.0.12+7-Ubuntu-1ubuntu224.04",
        "java.specification.name": "Java Platform API Specification",
        "java.specification.vendor": "Oracle Corporation",
        "java.specification.version": "17",
        "java.vendor": "Ubuntu",
        "java.vendor.url": "https://ubuntu.com/",
        "java.vendor.url.bug": "https://bugs.launchpad.net/ubuntu/+source/openjdk-17",
        "java.version": "17.0.12",
        "java.version.date": "2024-07-16",
        "java.vm.compressedOopsMode": "32-bit",
        "java.vm.info": "mixed mode, sharing",
        "java.vm.name": "OpenJDK 64-Bit Server VM",
        "java.vm.specification.name": "Java Virtual Machine Specification",
        "java.vm.specification.vendor": "Oracle Corporation",
        "java.vm.specification.version": "17",
        "java.vm.vendor": "Ubuntu",
        "java.vm.version": "17.0.12+7-Ubuntu-1ubuntu224.04",
        "jdk.debug": "release",
        "line.separator": "\n",
        "logbackDisableServletContainerInitializer": "true",
        "native.encoding": "UTF-8",
        "org.apache.catalina.startup.EXIT_ON_INIT_FAILURE": "true",
        "org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH": "true",
        "os.arch": "amd64",
        "os.name": "Linux",
        "os.version": "6.8.0-1015-azure",
        "path.separator": ":",
        "sun.arch.data.model": "64",
        "sun.boot.library.path": "/usr/lib/jvm/java-17-openjdk-amd64/lib",
        "sun.cpu.endian": "little",
        "sun.io.unicode.encoding": "UnicodeLittle",
        "sun.java.command": "org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process5619971727466462858properties",
        "sun.java.launcher": "SUN_STANDARD",
        "sun.jnu.encoding": "UTF-8",
        "sun.management.compiler": "HotSpot 64-Bit Tiered Compilers",
        "user.dir": "/home/sonar/sonarqube-10.7.0.96327",
        "user.home": "/home/sonar",
        "user.language": "en",
        "user.name": "sonar",
        "user.timezone": "Etc/UTC"
    },
    "Compute Engine Tasks": {
        "Pending": 0,
        "Longest Time Pending (ms)": 0,
        "In Progress": 1,
        "Processed With Error": 0,
        "Processed With Success": 0,
        "Processing Time (ms)": 0,
        "Worker Count": 1,
        "Max Worker Count": 1,
        "Workers Paused": false
    },
    "Compute Engine JVM State": {
        "Max Memory (MB)": 1024,
        "Free Memory (MB)": 97,
        "Heap Committed (MB)": 524,
        "Heap Init (MB)": 128,
        "Heap Max (MB)": 1024,
        "Heap Used (MB)": 426,
        "Non Heap Committed (MB)": 101,
        "Non Heap Init (MB)": 7,
        "Non Heap Used (MB)": 97,
        "System Load Average": "0.0% (last minute)",
        "Threads": 24
    },
    "Compute Engine Database Connection": {
        "Pool Total Connections": 11,
        "Pool Active Connections": 1,
        "Pool Idle Connections": 10,
        "Pool Max Connections": 60,
        "Pool Min Idle Connections": 10,
        "Pool Max Wait (ms)": 8000,
        "Pool Max Lifetime (ms)": 1800000
    },
    "Compute Engine Logging": {
        "Logs Level": "INFO",
        "Logs Dir": "/home/sonar/sonarqube-10.7.0.96327/logs"
    },
    "Compute Engine JVM Properties": {
        "com.zaxxer.hikari.pool_number": "1",
        "file.encoding": "UTF-8",
        "file.separator": "/",
        "http.nonProxyHosts": "localhost|127.*|[::1]",
        "java.awt.headless": "true",
        "java.class.path": "./lib/sonar-application-10.7.0.96327.jar:/home/sonar/sonarqube-10.7.0.96327/lib/jdbc/mssql/mssql-jdbc-12.6.3.jre11.jar",
        "java.class.version": "61.0",
        "java.home": "/usr/lib/jvm/java-17-openjdk-amd64",
        "java.io.tmpdir": "/opt/sonarqube/temp",
        "java.library.path": "/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib",
        "java.runtime.name": "OpenJDK Runtime Environment",
        "java.runtime.version": "17.0.12+7-Ubuntu-1ubuntu224.04",
        "java.specification.name": "Java Platform API Specification",
        "java.specification.vendor": "Oracle Corporation",
        "java.specification.version": "17",
        "java.vendor": "Ubuntu",
        "java.vendor.url": "https://ubuntu.com/",
        "java.vendor.url.bug": "https://bugs.launchpad.net/ubuntu/+source/openjdk-17",
        "java.version": "17.0.12",
        "java.version.date": "2024-07-16",
        "java.vm.compressedOopsMode": "32-bit",
        "java.vm.info": "mixed mode, sharing",
        "java.vm.name": "OpenJDK 64-Bit Server VM",
        "java.vm.specification.name": "Java Virtual Machine Specification",
        "java.vm.specification.vendor": "Oracle Corporation",
        "java.vm.specification.version": "17",
        "java.vm.vendor": "Ubuntu",
        "java.vm.version": "17.0.12+7-Ubuntu-1ubuntu224.04",
        "jdk.debug": "release",
        "line.separator": "\n",
        "native.encoding": "UTF-8",
        "os.arch": "amd64",
        "os.name": "Linux",
        "os.version": "6.8.0-1015-azure",
        "path.separator": ":",
        "sun.arch.data.model": "64",
        "sun.boot.library.path": "/usr/lib/jvm/java-17-openjdk-amd64/lib",
        "sun.cpu.endian": "little",
        "sun.io.unicode.encoding": "UnicodeLittle",
        "sun.java.command": "org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process11150670120600123476properties",
        "sun.java.launcher": "SUN_STANDARD",
        "sun.jnu.encoding": "UTF-8",
        "sun.management.compiler": "HotSpot 64-Bit Tiered Compilers",
        "user.dir": "/home/sonar/sonarqube-10.7.0.96327",
        "user.home": "/home/sonar",
        "user.language": "en",
        "user.name": "sonar",
        "user.timezone": "Etc/UTC"
    },
    "Search State": {
        "State": "GREEN",
        "CPU Usage (%)": 0,
        "Disk Available": "122.3 GB",
        "Store Size": "81.2 MB",
        "Translog Size": "1.3 kB",
        "Open File Descriptors": 248,
        "Max File Descriptors": 1048576,
        "JVM Heap Usage": "45.0%",
        "JVM Heap Used": "242.7 MB",
        "JVM Heap Max": "536.9 MB",
        "JVM Non Heap Used": "124.8 MB",
        "JVM Threads": 88,
        "Field Data Memory": "523.1 kB",
        "Field Data Circuit Breaker Limit": "214.7 MB",
        "Field Data Circuit Breaker Estimation": "523.1 kB",
        "Request Circuit Breaker Limit": "322.1 MB",
        "Request Circuit Breaker Estimation": "0 bytes",
        "Query Cache Memory": "14.0 kB",
        "Request Cache Memory": "0 bytes"
    },
    "Search Indexes": {
        "Index components - Docs": 2,
        "Index components - Shards": 5,
        "Index components - Store Size": "17.3 kB",
        "Index metadatas - Docs": 15,
        "Index metadatas - Shards": 1,
        "Index metadatas - Store Size": "17.3 kB",
        "Index projectmeasures - Docs": 2,
        "Index projectmeasures - Shards": 5,
        "Index projectmeasures - Store Size": "16.7 kB",
        "Index rules - Docs": 26868,
        "Index rules - Shards": 2,
        "Index rules - Store Size": "24.3 MB",
        "Index issues - Docs": 222965,
        "Index issues - Shards": 5,
        "Index issues - Store Size": "56.9 MB",
        "Index views - Docs": 0,
        "Index views - Shards": 5,
        "Index views - Store Size": "1.2 kB"
    },
    "ALMs": {
        "SourceDB": "Alm:azure_devops, Url:XXXXXXXXXXXXX"
    },
    "Server Push Connections": {
        "SonarLint Connected Clients": 0
    },
    "Settings": {
        "http.nonProxyHosts": "localhost|127.*|[::1]",
        "process.gracefulStopTimeout": "270000",
        "process.index": "2",
        "process.key": "web",
        "process.sharedDir": "/opt/sonarqube/temp",
        "projects.default.visibility": "public",
        "qualitygate.default": "a92afbf5-8d78-4d5b-8513-45115b71a76e",
        "sonar.authenticator.ignoreStartupFailure": "false",
        "sonar.autoDatabaseUpgrade": "false",
        "sonar.ce.gracefulStopTimeOutInMs": "21600000",
        "sonar.ce.javaAdditionalOpts": "-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-1.22.0.jar\u003dce",
        "sonar.ce.javaOpts": "-Xmx1024m -Xms128m -XX:+HeapDumpOnOutOfMemoryError",
        "sonar.cluster.enabled": "false",
        "sonar.cluster.kubernetes": "false",
        "sonar.cluster.name": "sonarqube",
        "sonar.cluster.node.name": "sonarqube-beeba96a-ccb8-4d89-a5a6-e06d1736ae6b",
        "sonar.cluster.node.port": "9003",
        "sonar.cluster.web.startupLeader": "true",
        "sonar.core.id": "FAA8123E-AZJ3BH7nP4MU2C8MUL32",
        "sonar.core.serverBaseURL": "http://s-010-0070:9000",
        "sonar.core.startTime": "2024-10-14T11:43:47+0000",
        "sonar.dbcleaner.branchesToKeepWhenInactive": "main,master,develop,trunk,hotfix/.*",
        "sonar.es.port": "37055",
        "sonar.forceAuthentication": "true",
        "sonar.jdbc.driverPath": "/home/sonar/sonarqube-10.7.0.96327/lib/jdbc/mssql/mssql-jdbc-12.6.3.jre11.jar",
        "sonar.jdbc.idleTimeout": "600000",
        "sonar.jdbc.keepaliveTime": "180000",
        "sonar.jdbc.maxActive": "60",
        "sonar.jdbc.maxLifetime": "1800000",
        "sonar.jdbc.maxWait": "8000",
        "sonar.jdbc.minIdle": "10",
        "sonar.jdbc.password": "xxxxxxxx",
        "sonar.jdbc.url": "jdbc:sqlserver://sql-prod-sonarcube.spe-ch-md9.net;databaseName\u003dDevOps_Sonarqube;encrypt\u003dfalse",
        "sonar.jdbc.username": "Sonarqube",
        "sonar.jdbc.validationTimeout": "5000",
        "sonar.lf.enableGravatar": "true",
        "sonar.log.jsonOutput": "false",
        "sonar.path.data": "/opt/sonarqube/data",
        "sonar.path.home": "/home/sonar/sonarqube-10.7.0.96327",
        "sonar.path.logs": "/home/sonar/sonarqube-10.7.0.96327/logs",
        "sonar.path.temp": "/opt/sonarqube/temp",
        "sonar.path.web": "/home/sonar/sonarqube-10.7.0.96327/web",
        "sonar.plugins.risk.consent": "ACCEPTED",
        "sonar.qualityProfiles.allowDisableInheritedRules": "true",
        "sonar.search.host": "127.0.0.1",
        "sonar.search.javaAdditionalOpts": "",
        "sonar.search.javaOpts": "-Xmx512m -Xms512m -XX:MaxDirectMemorySize\u003d256m -XX:+HeapDumpOnOutOfMemoryError",
        "sonar.search.port": "9001",
        "sonar.telemetry.compression": "true",
        "sonar.telemetry.enable": "true",
        "sonar.telemetry.frequencyInSeconds": "10800",
        "sonar.telemetry.metrics.url": "https://telemetry.sonarsource.com/sonarqube/metrics",
        "sonar.telemetry.url": "https://telemetry.sonarsource.com/sonarqube",
        "sonar.updatecenter.activate": "true",
        "sonar.web.gracefulStopTimeOutInMs": "240000",
        "sonar.web.javaAdditionalOpts": "-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-1.22.0.jar\u003dweb",
        "sonar.web.javaOpts": "-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError",
        "sonar.web.sso.emailHeader": "X-Forwarded-Email",
        "sonar.web.sso.enable": "false",
        "sonar.web.sso.groupsHeader": "X-Forwarded-Groups",
        "sonar.web.sso.loginHeader": "X-Forwarded-Login",
        "sonar.web.sso.nameHeader": "X-Forwarded-Name",
        "sonar.web.sso.refreshIntervalInMinutes": "5",
        "Default New Code Definition": "PREVIOUS_VERSION"
    }
}

Hi,

In Community Edition, only one analysis report will be processed at a time. Assuming the CE process has enough memory (which you can tune with JavaOpts, you would next look at latency: network and disk, and then at DB performance.

 
HTH,
Ann

Hi,

Just to clarify, are you referring to the SonarQube server or the server where the scanner was running?

You mentioned the “Compute Engine” on the title, which is responsible for processing the analysis reports server-side after the scanner finishes. However, your description seems to indicate you were expecting some CPU usage on the server during the execution of the scanner.

The scanner runs almost completely locally, and it doesn’t send your code to the server for analysis. Therefore, it’s normal for the SonarQube server to remain “inactive” during the scanning process.

1 Like

Hi Ann,

I know that the CE edition can only process one report at a time. But even in this case it should utilize more CPU power. I already increased the heap size to 1024m. The disk utilization is at 1%. Database is on a cluster and it is very unlikely that this is the bottleneck. Also the network connection is not busy with 100-150kb/s.

Hi Scott,

I’m talking about the report processing on the server, not the analysis on the client.

Hi,

If you bump server logging up to DEBUG, you’ll be able to see where time is spent during analysis report processing.

 
Ann