summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java2
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java6
-rw-r--r--config-provisioning/src/test/java/com/yahoo/config/provision/ClusterResourcesTest.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/QuotaUsageTest.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-cloud.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-with-routing-policy.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-without-shared-endpoints.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/recursive-root.json4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/tenant1-recursive.json4
-rw-r--r--fsa/src/vespa/fsa/automaton.cpp8
-rw-r--r--fsa/src/vespa/fsa/fsa.cpp16
-rw-r--r--fsa/src/vespa/fsa/fsa.h15
-rw-r--r--fsa/src/vespa/fsa/unaligned.h56
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepoStatsTest.java18
-rw-r--r--searchcore/src/vespa/searchcore/config/proton.def5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h3
24 files changed, 135 insertions, 58 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
index 16ab941d3be..8750d3caa47 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
@@ -21,7 +21,7 @@ public class QuotaValidatorTest {
private final Zone publicZone = new Zone(SystemName.Public, Environment.prod, RegionName.from("foo"));
private final Zone publicCdZone = new Zone(SystemName.PublicCd, Environment.prod, RegionName.from("foo"));
- private final Quota quota = Quota.unlimited().withClusterSize(10).withBudget(BigDecimal.valueOf(1));
+ private final Quota quota = Quota.unlimited().withClusterSize(10).withBudget(BigDecimal.valueOf(1.25));
@Test
public void test_deploy_under_quota() {
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
index 21349910ca1..25771f1906b 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
@@ -12,9 +12,9 @@ import java.util.Optional;
public class NodeResources {
// Standard unit cost in dollars per hour
- private static final double cpuUnitCost = 0.09;
- private static final double memoryUnitCost = 0.009;
- private static final double diskUnitCost = 0.0003;
+ private static final double cpuUnitCost = 0.11;
+ private static final double memoryUnitCost = 0.011;
+ private static final double diskUnitCost = 0.0004;
private static final NodeResources zero = new NodeResources(0, 0, 0, 0);
private static final NodeResources unspecified = new NodeResources(0, 0, 0, 0);
diff --git a/config-provisioning/src/test/java/com/yahoo/config/provision/ClusterResourcesTest.java b/config-provisioning/src/test/java/com/yahoo/config/provision/ClusterResourcesTest.java
index e342a90c957..cbca931e4d0 100644
--- a/config-provisioning/src/test/java/com/yahoo/config/provision/ClusterResourcesTest.java
+++ b/config-provisioning/src/test/java/com/yahoo/config/provision/ClusterResourcesTest.java
@@ -14,7 +14,7 @@ public class ClusterResourcesTest {
public void testCost() {
ClusterResources r1 = new ClusterResources(3, 1, new NodeResources(2, 8, 50, 1));
ClusterResources r2 = new ClusterResources(3, 1, new NodeResources(2, 16, 50, 1));
- assertEquals(1.818, r1.cost() + r2.cost(), 0.01);
+ assertEquals(2.232, r1.cost() + r2.cost(), 0.01);
}
}
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
index 8c1a0ac1d25..5a12eeddd17 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
@@ -34,6 +34,7 @@ public class QueryProfileProperties extends Properties {
private final CompiledQueryProfile profile;
private final Map<String, Embedder> embedders;
private final ZoneInfo zoneInfo;
+ private final Map<String, String> zoneContext;
// Note: The priority order is: values has precedence over references
@@ -68,6 +69,11 @@ public class QueryProfileProperties extends Properties {
this.profile = profile;
this.embedders = embedders;
this.zoneInfo = zoneInfo;
+ this.zoneContext = Map.of(
+ "environment", zoneInfo.zone().environment().name(),
+ "region", zoneInfo.zone().region(),
+ "instance", zoneInfo.application().instance());
+
}
/** Returns the query profile backing this, or null if none */
@@ -289,8 +295,10 @@ public class QueryProfileProperties extends Properties {
private Map<String, String> contextWithZoneInfo(Map<String, String> context) {
if (zoneInfo == ZoneInfo.defaultInfo()) return context;
+ if (context == null) return zoneContext;
+ if (context == zoneContext) return context;
- Map<String, String> contextWithZoneInfo = context == null ? new HashMap<>() : new HashMap<>(context);
+ Map<String, String> contextWithZoneInfo = new HashMap<>(context);
contextWithZoneInfo.putIfAbsent("environment", zoneInfo.zone().environment().name());
contextWithZoneInfo.putIfAbsent("region", zoneInfo.zone().region());
contextWithZoneInfo.putIfAbsent("instance", zoneInfo.application().instance());
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java
index 96b0e3137cb..11b3ad0d45a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java
@@ -101,7 +101,7 @@ public class DeploymentQuotaCalculatorTest {
var mapper = new ObjectMapper();
var application = mapper.readValue(content, ApplicationData.class).toApplication();
var usage = DeploymentQuotaCalculator.calculateQuotaUsage(application);
- assertEquals(1.068, usage.rate(), 0.001);
+ assertEquals(1.312, usage.rate(), 0.001);
}
@Test
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/QuotaUsageTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/QuotaUsageTest.java
index 5ce6c95ee82..772d65fa80e 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/QuotaUsageTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/QuotaUsageTest.java
@@ -15,7 +15,7 @@ public class QuotaUsageTest {
public void testQuotaUsageIsPersisted() {
var tester = new DeploymentTester();
var context = tester.newDeploymentContext().submit().deploy();
- assertEquals(1.062, context.deployment(ZoneId.from("prod.us-west-1")).quota().rate(), 0.01);
+ assertEquals(1.304, context.deployment(ZoneId.from("prod.us-west-1")).quota().rate(), 0.01);
}
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java
index 320938f00e4..a8d39438654 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java
@@ -65,8 +65,8 @@ public class ResourceMeterMaintainerTest {
new ResourceSnapshot(app1, 23, 45, 67, NodeResources.Architecture.getDefault(), Instant.EPOCH, z2),
new ResourceSnapshot(app2, 34, 56, 78, NodeResources.Architecture.getDefault(), Instant.EPOCH, z1));
maintainer.updateDeploymentCost(resourceSnapshots);
- assertCost.accept(app1, Map.of(z1, 1.40, z2, 2.50));
- assertCost.accept(app2, Map.of(z1, 3.59));
+ assertCost.accept(app1, Map.of(z1, 1.72, z2, 3.05));
+ assertCost.accept(app2, Map.of(z1, 4.39));
// Remove a region from app1 and add region to app2
resourceSnapshots = List.of(
@@ -74,9 +74,9 @@ public class ResourceMeterMaintainerTest {
new ResourceSnapshot(app2, 34, 56, 78, NodeResources.Architecture.getDefault(), Instant.EPOCH, z1),
new ResourceSnapshot(app2, 45, 67, 89, NodeResources.Architecture.getDefault(), Instant.EPOCH, z2));
maintainer.updateDeploymentCost(resourceSnapshots);
- assertCost.accept(app1, Map.of(z2, 2.50));
- assertCost.accept(app2, Map.of(z1, 3.59, z2, 4.68));
- assertEquals(1.4,
+ assertCost.accept(app1, Map.of(z2, 3.05));
+ assertCost.accept(app2, Map.of(z1, 4.39, z2, 5.72));
+ assertEquals(1.72,
(Double) metrics.getMetric(context ->
z1.value().equals(context.get("zoneId")) &&
app1.tenant().value().equals(context.get("tenant")),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json
index d90e03a1439..3eff2ab781a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json
@@ -13,7 +13,7 @@
"diskSpeed": "slow",
"storageType": "remote"
},
- "cost": 0.09
+ "cost": 0.11
},
"max": {
"nodes": 2,
@@ -26,7 +26,7 @@
"diskSpeed": "slow",
"storageType": "remote"
},
- "cost": 0.35
+ "cost": 0.43
},
"current": {
"nodes": 2,
@@ -39,7 +39,7 @@
"diskSpeed": "slow",
"storageType": "remote"
},
- "cost": 0.18
+ "cost": 0.22
},
"target": {
"nodes": 2,
@@ -52,7 +52,7 @@
"diskSpeed": "slow",
"storageType": "remote"
},
- "cost": 0.24
+ "cost": 0.29
},
"utilization": {
"cpu": 0.1,
@@ -91,7 +91,7 @@
"diskSpeed": "slow",
"storageType": "remote"
},
- "cost": 0.18
+ "cost": 0.22
},
"at": 1234,
"completion": 2234
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-cloud.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-cloud.json
index 5268b7b56cb..4d0f1259c07 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-cloud.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-cloud.json
@@ -29,7 +29,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": { },
"metrics": {
"queriesPerSecond": 0.0,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-with-routing-policy.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-with-routing-policy.json
index 7244cf1493a..b0a8ceeeff0 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-with-routing-policy.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-with-routing-policy.json
@@ -29,7 +29,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": { },
"metrics": {
"queriesPerSecond": 0.0,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-without-shared-endpoints.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-without-shared-endpoints.json
index 7244cf1493a..b0a8ceeeff0 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-without-shared-endpoints.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-without-shared-endpoints.json
@@ -29,7 +29,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": { },
"metrics": {
"queriesPerSecond": 0.0,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json
index 1448b79385b..37bd69d5863 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json
@@ -54,7 +54,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json
index 4bd328f605f..d78ab67dcc5 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/instance1-recursive.json
@@ -66,7 +66,7 @@
"deployTimeEpochMs": 1600000000000,
"screwdriverId": "123",
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
@@ -141,7 +141,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/recursive-root.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/recursive-root.json
index bfbeda9233d..8d76d54458d 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/recursive-root.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/recursive-root.json
@@ -73,7 +73,7 @@
"deployTimeEpochMs": 1600000000000,
"screwdriverId": "123",
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
@@ -148,7 +148,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/tenant1-recursive.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/tenant1-recursive.json
index 054aaec0fcd..b9bf714d362 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/tenant1-recursive.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/tenant1-recursive.json
@@ -72,7 +72,7 @@
"deployTimeEpochMs": 1600000000000,
"screwdriverId": "123",
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
@@ -147,7 +147,7 @@
"commit": "commit1"
},
"status": "complete",
- "quota": 1.062,
+ "quota": 1.304,
"activity": {
"lastQueried": 1527848130000,
"lastWritten": 1527848130000,
diff --git a/fsa/src/vespa/fsa/automaton.cpp b/fsa/src/vespa/fsa/automaton.cpp
index 91592078c98..57bcfb180a8 100644
--- a/fsa/src/vespa/fsa/automaton.cpp
+++ b/fsa/src/vespa/fsa/automaton.cpp
@@ -11,7 +11,7 @@
#include "fsa.h"
#include "automaton.h"
#include "checksum.h"
-
+#include "unaligned.h"
namespace fsa {
@@ -354,7 +354,7 @@ void Automaton::PackedAutomaton::finalize()
uint32_t j=lastsize;
bool fixedsize = true;
while(i<_blob_used){
- currsize = *((uint32_t*)(void *)(_blob+i));
+ currsize = Unaligned<uint32_t>::at(_blob+i);
if(currsize!=lastsize){
fixedsize = false;
break;
@@ -597,14 +597,14 @@ bool Automaton::PackedAutomaton::getFSA(FSA::Descriptor &d)
d._version = FSA::VER;
d._serial = 0;
- d._state = _packed_idx;
+ d._state = Unaligned<state_t>::ptr(_packed_idx);
d._symbol = _symbol;
d._size = size;
d._data = _blob;
d._data_size = _blob_used;
d._data_type = _blob_type;
d._fixed_data_size = _fixed_blob_size;
- d._perf_hash = _perf_hash;
+ d._perf_hash = Unaligned<hash_t>::ptr(_perf_hash);
d._start = _start_state;
_symbol = NULL;
diff --git a/fsa/src/vespa/fsa/fsa.cpp b/fsa/src/vespa/fsa/fsa.cpp
index 50fd8bff85d..4abc6f979d8 100644
--- a/fsa/src/vespa/fsa/fsa.cpp
+++ b/fsa/src/vespa/fsa/fsa.cpp
@@ -227,7 +227,7 @@ bool FSA::read(const char *file, FileAccessMethod fam)
checksum += Checksum::compute(_symbol,_size*sizeof(symbol_t));
if(_mmap_addr==NULL){
- _state = (state_t*)malloc(_size*sizeof(state_t));
+ _state = Unaligned<state_t>::ptr(malloc(_size*sizeof(state_t)));
r=::read(fd,_state,_size*sizeof(state_t));
if(r!=_size*sizeof(state_t)){
::close(fd);
@@ -236,8 +236,8 @@ bool FSA::read(const char *file, FileAccessMethod fam)
}
}
else {
- _state = (state_t*)(void *)((uint8_t*)_mmap_addr + sizeof(header) +
- _size*sizeof(symbol_t));
+ _state = Unaligned<state_t>::ptr((uint8_t*)_mmap_addr + sizeof(header) +
+ _size*sizeof(symbol_t));
}
checksum += Checksum::compute(_state,_size*sizeof(state_t));
@@ -259,7 +259,7 @@ bool FSA::read(const char *file, FileAccessMethod fam)
if(header._has_perfect_hash){
if(_mmap_addr==NULL){
- _perf_hash = (hash_t*)malloc(_size*sizeof(hash_t));
+ _perf_hash = Unaligned<hash_t>::ptr(malloc(_size*sizeof(hash_t)));
r=::read(fd,_perf_hash,_size*sizeof(hash_t));
if(r!=_size*sizeof(hash_t)){
::close(fd);
@@ -268,10 +268,10 @@ bool FSA::read(const char *file, FileAccessMethod fam)
}
}
else {
- _perf_hash = (hash_t*)(void *)((uint8_t*)_mmap_addr + sizeof(header) +
- _size*sizeof(symbol_t) +
- _size*sizeof(state_t) +
- _data_size);
+ _perf_hash = Unaligned<hash_t>::ptr((uint8_t*)_mmap_addr + sizeof(header) +
+ _size*sizeof(symbol_t) +
+ _size*sizeof(state_t) +
+ _data_size);
}
checksum += Checksum::compute(_perf_hash,_size*sizeof(hash_t));
_has_perfect_hash = true;
diff --git a/fsa/src/vespa/fsa/fsa.h b/fsa/src/vespa/fsa/fsa.h
index 915aeb17a17..f3703b398ba 100644
--- a/fsa/src/vespa/fsa/fsa.h
+++ b/fsa/src/vespa/fsa/fsa.h
@@ -15,6 +15,7 @@
#include <inttypes.h>
#include "file.h" // for FileAccessMethod
+#include "unaligned.h"
namespace fsa {
@@ -614,10 +615,10 @@ public:
return (uint32_t)((const uint8_t*)da)[0];
case 2:
case 3:
- return (uint32_t)((const uint16_t*)(const void *)da)[0];
+ return (uint32_t)Unaligned<uint16_t>::at(da).read();
case 4:
default:
- return ((const uint32_t*)(const void *) da)[0];
+ return Unaligned<uint32_t>::at(da).read();
}
}
@@ -2019,14 +2020,14 @@ public:
struct Descriptor {
uint32_t _version;
uint32_t _serial;
- state_t *_state;
+ Unaligned<state_t> *_state;
symbol_t *_symbol;
uint32_t _size;
data_t *_data;
uint32_t _data_size;
uint32_t _data_type;
uint32_t _fixed_data_size;
- hash_t *_perf_hash;
+ Unaligned<hash_t> *_perf_hash;
uint32_t _start;
};
@@ -2040,7 +2041,7 @@ private:
uint32_t _version; /**< Version of fsalib used to build this fsa. */
uint32_t _serial; /**< Serial number of this fsa. */
- state_t *_state; /**< State table for transitions. */
+ Unaligned<state_t> *_state; /**< State table for transitions. */
symbol_t *_symbol; /**< Symbol table for transitions. */
uint32_t _size; /**< Size (number of cells). */
@@ -2050,7 +2051,7 @@ private:
uint32_t _fixed_data_size; /**< Size of data items if fixed. */
bool _has_perfect_hash; /**< Indicator of perfect hash present. */
- hash_t *_perf_hash; /**< Perfect hash table, if present. */
+ Unaligned<hash_t> *_perf_hash; /**< Perfect hash table, if present. */
state_t _start; /**< Index of start state. */
@@ -2205,7 +2206,7 @@ public:
if(_data_type==DATA_FIXED)
return _fixed_data_size;
else
- return (int)(*((uint32_t*)(void *)(_data+_state[fs+FINAL_SYMBOL])));
+ return (int)Unaligned<uint32_t>::at(_data+_state[fs+FINAL_SYMBOL]).read();
}
return -1;
}
diff --git a/fsa/src/vespa/fsa/unaligned.h b/fsa/src/vespa/fsa/unaligned.h
new file mode 100644
index 00000000000..ff645194e4f
--- /dev/null
+++ b/fsa/src/vespa/fsa/unaligned.h
@@ -0,0 +1,56 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <cstring>
+
+namespace fsa {
+
+template <typename T>
+class Unaligned {
+private:
+ char _data[sizeof(T)];
+
+public:
+ Unaligned() = delete;
+ Unaligned(const Unaligned &) = delete;
+ Unaligned(Unaligned &&) = delete;
+
+ Unaligned &operator=(const Unaligned &) = default;
+ Unaligned &operator=(Unaligned &&) = default;
+
+ static_assert(std::is_trivial_v<T>);
+ static_assert(alignof(T) > 1, "value is always aligned");
+
+ constexpr static Unaligned &at(void *p) noexcept {
+ return *reinterpret_cast<Unaligned*>(p);
+ }
+ constexpr static const Unaligned &at(const void *p) noexcept {
+ return *reinterpret_cast<const Unaligned*>(p);
+ }
+
+ constexpr static Unaligned *ptr(void *p) noexcept {
+ return reinterpret_cast<Unaligned*>(p);
+ }
+ constexpr static const Unaligned *ptr(const void *p) noexcept {
+ return reinterpret_cast<const Unaligned*>(p);
+ }
+
+ T read() const noexcept {
+ T value;
+ static_assert(sizeof(_data) == sizeof(value));
+ memcpy(&value, _data, sizeof(value));
+ return value;
+ }
+ void write(const T &value) noexcept {
+ static_assert(sizeof(_data) == sizeof(value));
+ memcpy(_data, &value, sizeof(value));
+ }
+ operator T () const noexcept { return read(); }
+ Unaligned &operator=(const T &value) noexcept {
+ write(value);
+ return *this;
+ }
+};
+
+}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepoStatsTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepoStatsTest.java
index 56f4863c881..62c96af7629 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepoStatsTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepoStatsTest.java
@@ -105,21 +105,21 @@ public class NodeRepoStatsTest {
var app3Stats = stats.applicationStats().get(1);
assertEquals(app1, app1Stats.id());
- assertEquals(2.940, app1Stats.cost(), delta);
- assertEquals(0.702, app1Stats.utilizedCost(), delta);
- assertEquals(2.238, app1Stats.unutilizedCost(), delta);
+ assertEquals(3.6400, app1Stats.cost(), delta);
+ assertEquals(0.8676, app1Stats.utilizedCost(), delta);
+ assertEquals(2.7724, app1Stats.unutilizedCost(), delta);
assertLoad(new Load(0.2571, 0.2314, 0.2057), app1Stats.load());
assertEquals(app2, app2Stats.id());
- assertEquals(1.680, app2Stats.cost(), delta);
- assertEquals(0.624, app2Stats.utilizedCost(), delta);
- assertEquals(1.056, app2Stats.unutilizedCost(), delta);
+ assertEquals(2.0799, app2Stats.cost(), delta);
+ assertEquals(0.7712, app2Stats.utilizedCost(), delta);
+ assertEquals(1.3087, app2Stats.unutilizedCost(), delta);
assertLoad(new Load(.40, 0.36, 0.32), app2Stats.load());
assertEquals(app3, app3Stats.id());
- assertEquals(2.100, app3Stats.cost(), delta);
- assertEquals(0.975, app3Stats.utilizedCost(), delta);
- assertEquals(1.125, app3Stats.unutilizedCost(), delta);
+ assertEquals(2.6000, app3Stats.cost(), delta);
+ assertEquals(1.2049, app3Stats.utilizedCost(), delta);
+ assertEquals(1.3950, app3Stats.unutilizedCost(), delta);
assertLoad(new Load(0.5, 0.45, 0.40), app3Stats.load());
}
diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def
index ffd9db2f58b..5829666c41b 100644
--- a/searchcore/src/vespa/searchcore/config/proton.def
+++ b/searchcore/src/vespa/searchcore/config/proton.def
@@ -483,6 +483,11 @@ hwinfo.cpu.cores int default = 0 restart
## See shared_threading_service_config.cpp for details on how the thread pool sizes are calculated.
feeding.concurrency double default = 0.2 restart
+## A number between 0.0 and 1.0 telling how nice the feed and background threads shall be.
+## A value of 0.0, which is default, means 'not any nicer than anyone else'.
+## The scale from 0.0 to 1.0 is not linear. It is OS specific.
+feeding.niceness double default = 0.0 restart
+
## Maximum number of pending tasks for the master thread in each document db.
##
## This limit is only considered when executing tasks for handling external feed operations.
diff --git a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp
index 86db96a20ac..5f522bfaffc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp
@@ -6,6 +6,7 @@
#include <vespa/vespalib/util/cpu_usage.h>
#include <vespa/vespalib/util/sequencedtaskexecutor.h>
#include <vespa/vespalib/util/size_literals.h>
+#include <vespa/vespalib/util/nice.h>
using vespalib::CpuUsage;
using vespalib::steady_time;
@@ -24,7 +25,7 @@ SharedThreadingService::SharedThreadingService(const SharedThreadingServiceConfi
CpuUsage::wrap(proton_warmup_executor, CpuUsage::Category::COMPACT),
cfg.shared_task_limit())),
_shared(std::make_shared<vespalib::BlockingThreadStackExecutor>(cfg.shared_threads(), 128_Ki,
- cfg.shared_task_limit(), proton_shared_executor)),
+ cfg.shared_task_limit(), vespalib::be_nice(proton_shared_executor, cfg.feeding_niceness()))),
_field_writer(),
_invokeService(std::max(vespalib::adjustTimeoutByDetectedHz(1ms),
cfg.field_writer_config().reactionTime())),
@@ -33,7 +34,7 @@ SharedThreadingService::SharedThreadingService(const SharedThreadingServiceConfi
_clock(_invokeService.nowRef())
{
const auto& fw_cfg = cfg.field_writer_config();
- _field_writer = vespalib::SequencedTaskExecutor::create(CpuUsage::wrap(proton_field_writer_executor, CpuUsage::Category::WRITE),
+ _field_writer = vespalib::SequencedTaskExecutor::create(vespalib::be_nice(CpuUsage::wrap(proton_field_writer_executor, CpuUsage::Category::WRITE), cfg.feeding_niceness()),
cfg.field_writer_threads(),
fw_cfg.defaultTaskLimit(),
fw_cfg.is_task_limit_hard(),
diff --git a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp
index 002ac508b4a..50ef5039e75 100644
--- a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp
@@ -12,11 +12,13 @@ SharedThreadingServiceConfig::SharedThreadingServiceConfig(uint32_t shared_threa
uint32_t shared_task_limit_in,
uint32_t warmup_threads_in,
uint32_t field_writer_threads_in,
+ double feeding_niceness_in,
const ThreadingServiceConfig& field_writer_config_in)
: _shared_threads(shared_threads_in),
_shared_task_limit(shared_task_limit_in),
_warmup_threads(warmup_threads_in),
_field_writer_threads(field_writer_threads_in),
+ _feeding_niceness(feeding_niceness_in),
_field_writer_config(field_writer_config_in)
{
}
@@ -61,6 +63,7 @@ SharedThreadingServiceConfig::make(const proton::SharedThreadingServiceConfig::P
return proton::SharedThreadingServiceConfig(shared_threads, shared_threads * 16,
derive_warmup_threads(cpu_info),
field_writer_threads,
+ cfg.feeding.niceness,
ThreadingServiceConfig::make(cfg));
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h
index 5a2468ca1ab..add592f463d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h
+++ b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h
@@ -20,6 +20,7 @@ private:
uint32_t _shared_task_limit;
uint32_t _warmup_threads;
uint32_t _field_writer_threads;
+ double _feeding_niceness;
ThreadingServiceConfig _field_writer_config;
public:
@@ -27,6 +28,7 @@ public:
uint32_t shared_task_limit_in,
uint32_t warmup_threads_in,
uint32_t field_writer_threads_in,
+ double feed_niceness_in,
const ThreadingServiceConfig& field_writer_config_in);
static SharedThreadingServiceConfig make(const ProtonConfig& cfg, const HwInfo::Cpu& cpu_info);
@@ -35,6 +37,7 @@ public:
uint32_t shared_task_limit() const { return _shared_task_limit; }
uint32_t warmup_threads() const { return _warmup_threads; }
uint32_t field_writer_threads() const { return _field_writer_threads; }
+ double feeding_niceness() const { return _feeding_niceness; }
const ThreadingServiceConfig& field_writer_config() const { return _field_writer_config; }
};