Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.inject.Inject;
import com.sun.management.UnixOperatingSystemMXBean;
import io.airlift.units.DataSize;

import java.lang.management.ManagementFactory;
import java.util.concurrent.TimeUnit;

import static com.google.common.base.Verify.verify;
import static java.lang.Math.clamp;
import static java.lang.String.format;

public final class LocalMemoryManager
Expand All @@ -34,10 +31,6 @@ public final class LocalMemoryManager
private static final Supplier<Integer> AVAILABLE_PROCESSORS = Suppliers
.memoizeWithExpiration(Runtime.getRuntime()::availableProcessors, 30, TimeUnit.SECONDS);

// Clamp value because according to the documentation: if the recent CPU usage is not available, the method returns a negative value.
private static final Supplier<Double> SYSTEM_CPU_LOAD = Suppliers
.memoizeWithExpiration(() -> clamp(((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getCpuLoad(), 0.0, 1.0), 5, TimeUnit.SECONDS);

@Inject
public LocalMemoryManager(NodeMemoryConfig config)
{
Expand Down Expand Up @@ -70,7 +63,7 @@ private void validateHeapHeadroom(NodeMemoryConfig config, long availableMemory)

public MemoryInfo getInfo()
{
return new MemoryInfo(AVAILABLE_PROCESSORS.get(), SYSTEM_CPU_LOAD.get(), memoryPool.getInfo());
return new MemoryInfo(AVAILABLE_PROCESSORS.get(), memoryPool.getInfo());
}

public MemoryPool getMemoryPool()
Expand Down
10 changes: 0 additions & 10 deletions core/trino-main/src/main/java/io/trino/memory/MemoryInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@
public class MemoryInfo
{
private final int availableProcessors;
private final double systemCpuLoad;
private final MemoryPoolInfo pool;

@JsonCreator
public MemoryInfo(
@JsonProperty("availableProcessors") int availableProcessors,
@JsonProperty("systemCpuLoad") double systemCpuLoad,
@JsonProperty("pool") MemoryPoolInfo pool)
{
this.availableProcessors = availableProcessors;
this.systemCpuLoad = systemCpuLoad;
this.pool = requireNonNull(pool, "pool is null");
}

Expand All @@ -43,12 +40,6 @@ public int getAvailableProcessors()
return availableProcessors;
}

@JsonProperty
public double getSystemCpuLoad()
{
return systemCpuLoad;
}

@JsonProperty
public MemoryPoolInfo getPool()
{
Expand All @@ -60,7 +51,6 @@ public String toString()
{
return toStringHelper(this)
.add("availableProcessors", availableProcessors)
.add("systemCpuLoad", systemCpuLoad)
.add("pool", pool)
.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ protected void setup(Binder binder)

newExporter(binder).export(ClusterMemoryManager.class).withGeneratedName();

jaxrsBinder(binder).bind(GatewayResource.class);

// node partitioning manager
binder.bind(NodePartitioningManager.class).in(Scopes.SINGLETON);

Expand Down
67 changes: 0 additions & 67 deletions core/trino-main/src/main/java/io/trino/server/GatewayResource.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ private MemoryInfo buildWorkerMemoryInfo(DataSize usedMemory, Map<TaskId, DataSi
{
return new MemoryInfo(
4,
0,
new MemoryPoolInfo(
DataSize.of(64, GIGABYTE).toBytes(),
usedMemory.toBytes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ private MemoryInfo buildWorkerMemoryInfo(DataSize usedMemory, Map<TaskId, DataSi
{
return new MemoryInfo(
4,
0,
new MemoryPoolInfo(
DataSize.of(64, GIGABYTE).toBytes(),
usedMemory.toBytes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ private MemoryInfo buildWorkerMemoryInfo(DataSize usedMemory)
{
return new MemoryInfo(
4,
0,
new MemoryPoolInfo(
DataSize.of(64, GIGABYTE).toBytes(),
usedMemory.toBytes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static List<MemoryInfo> toNodeMemoryInfoList(long memoryPoolMaxBytes, Map<String
ImmutableMap.of(),
tasksMemoryInfoForNode(entry.getKey().getNodeIdentifier(), tasks),
ImmutableMap.of());
result.add(new MemoryInfo(7, 0, memoryPoolInfo));
result.add(new MemoryInfo(7, memoryPoolInfo));
}
return result.build();
}
Expand Down