Merge branch 'jshook/r-improvements'

This commit is contained in:
Jonathan Shook
2023-09-25 15:12:58 -05:00
10 changed files with 74 additions and 54 deletions

View File

@@ -17,17 +17,22 @@ description: |
Also, aggregates of recall should include total aggregate as well as a moving average.
scenarios:
default:
schema: run tags='block:schema' labels='target:astra' threads===1
rampup: run tags='block:rampup' labels='target:astra' threads=100 cycles=TEMPLATE(trainsize)
# search_and_index: run tags='block:search_and_index,optype=select' labels='target:astra' cycles=TEMPLATE(testsize) threads=2000 testsize=10000000 errors=count,warn stride=100 striderate=25
# search_and_index: run tags='block:search_and_index,optype=select' labels='target:astra' cycles=TEMPLATE(testsize) threads=1000 testsize=10000000 errors=count,retry stride=100 striderate=17.5
search_and_index: run tags='block:search_and_index,optype=select' labels='target:astra' cycles=TEMPLATE(testsize) threads=10 testsize=10000000 errors=count,retry stride=100 striderate=17.5
astra_vectors:
drop: run tags='block:drop' labels='target:astra' threads===1 cycles===2 driverconfig=app.conf
schema: run tags='block:schema' labels='target:astra' threads===1 cycles===2
rampup: run tags='block:rampup' labels='target:astra' threads=100 cycles=TEMPLATE(trainsize) errors=counter
search_and_index_unthrottled: >-
run tags='block:search_and_index,optype=select' labels='target:astra'
cycles=TEMPLATE(testsize) threads=10 errors=count,retry stride=500 errors=counter
search_and_index: >-
run alias=search_and_index tags='block:search_and_index,optype=select' labels='target:astra'
cycles=TEMPLATE(testsize) errors=count,retry stride=100 striderate=17.5
errors=counter threads=500
# one activity or two? data leap-frog? or concurrency separate for both?
# await_index: run tags='block:await_index' # This would need to exit when a condition is met
# stop_search_and_index: stop search_and_index
# await_index: run tags='block:await_index' # This would need to exit when a condition is met
# stop_search_and_index: stop search_and_index
# only possible if we have a triggering event to indicated
# live_search: run tags='block:search' labels='target:astra' threads=1 cycles=TEMPLATE(search_cycles,10000)
# live_search: run tags='block:search' labels='target:astra' threads=1 cycles=TEMPLATE(testsize,10000)
search_and_rewrite: run tags='block:search_and_rewrite' labels='target:astra'
search_and_invalidate: run tags='block:search_and_invalidate' labels='target:astra'
@@ -45,24 +50,33 @@ bindings:
synthetic_vectors: HashedFloatVectors(TEMPLATE(dimensions));
blocks:
drop:
params:
cl: TEMPLATE(cl,LOCAL_QUORUM)
prepared: false
ops:
drop_index: |
DROP INDEX IF EXISTS TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors);
drop_table: |
DROP TABLE IF EXISTS TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors);
schema:
params:
cl: TEMPLATE(cl,LOCAL_QUORUM)
prepared: false
ops:
# create-keyspace: |
# CREATE KEYSPACE IF NOT EXISTS TEMPLATE(keyspace,baselines)
# WITH replication = {'class': 'NetworkTopologyStrategy', 'TEMPLATE(region)': '3'};
create-table: |
# create_keyspace: |
# CREATE KEYSPACE IF NOT EXISTS TEMPLATE(keyspace,baselines)
# WITH replication = {'class': 'NetworkTopologyStrategy', 'TEMPLATE(region)': '3'};
create_table: |
CREATE TABLE IF NOT EXISTS TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors) (
key TEXT,
value vector<float,TEMPLATE(dimensions)>,
PRIMARY KEY (key)
);
create-sai-index: |
create_sai_index: |
CREATE CUSTOM INDEX IF NOT EXISTS ON TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors) (value) USING 'StorageAttachedIndex'
WITH OPTIONS = {'similarity_function' : 'TEMPLATE(similarity_function,cosine)'};
# WITH OPTIONS = {'maximum_node_connections' : TEMPLATE(M,16), 'construction_beam_width' : TEMPLATE(ef,100), 'similarity_function' : 'TEMPLATE(similarity_function,dot_product)'};
# WITH OPTIONS = {'maximum_node_connections' : TEMPLATE(M,16), 'construction_beam_width' : TEMPLATE(ef,100), 'similarity_function' : 'TEMPLATE(similarity_function,dot_product)'};
rampup:
params:
cl: TEMPLATE(write_cl,LOCAL_QUORUM)
@@ -71,6 +85,8 @@ blocks:
insert: |
INSERT INTO TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors)
(key, value) VALUES ({id},{train_floatlist});
# await_index:
# ops:
search_and_index:
ops:
select_ann_limit:
@@ -109,8 +125,6 @@ blocks:
tags:
optype: insert
# verifier-init: |
# verifier: |
search_and_rewrite:
ops:
select_ann_limit:
@@ -118,7 +132,7 @@ blocks:
SELECT * FROM TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors) ORDER BY value ANN OF {test_vector} LIMIT TEMPLATE(select_limit,100);
verifier-init: |
scriptingmetrics.newSummaryGauge(_parsed_op,"recall")
# verifier: |
# verifier: |
upsert_same:
stmt: |
INSERT INTO TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors)
@@ -128,9 +142,10 @@ blocks:
select_ann_limit:
stmt: |
SELECT * FROM TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors) ORDER BY value ANN OF {test_vector} LIMIT TEMPLATE(select_limit,100);
# verifier-init: |
# verifier: |
# verifier-init: |
# verifier: |
upsert_random: |
INSERT INTO TEMPLATE(keyspace,baselines).TEMPLATE(table,vectors)
(key, value) VALUES ({rw_key},{train_vector});

View File

@@ -407,7 +407,7 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
.element(this)
.now()
.layer(Layer.Session)
.detail("cli", String.join("\n", args))
.addDetail("cli", String.join("\n", args))
.build()
);

View File

@@ -58,8 +58,8 @@ public class GrafanaMetricsAnnotator implements Annotator, NBConfigurable {
try {
GAnnotation ga = new GAnnotation();
ga.setTime(annotation.getStart());
ga.setTimeEnd(annotation.getEnd());
ga.setTime(annotation.getStartMillis());
ga.setTimeEnd(annotation.getEndMillis());
annotation.getLabels().asMap().forEach((k, v) -> {
ga.getTags().add(k + ":" + v);
@@ -69,7 +69,7 @@ public class GrafanaMetricsAnnotator implements Annotator, NBConfigurable {
});
ga.getTags().add("layer:" + annotation.getLayer().toString());
if (annotation.getStart() == annotation.getEnd()) {
if (annotation.getStartMillis() == annotation.getEndMillis()) {
ga.getTags().add("span:instant");
} else {
ga.getTags().add("span:interval");

View File

@@ -107,7 +107,7 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
.element(this)
.interval(this.startedAt, this.stoppedAt)
.layer(Layer.Activity)
.detail("params", getActivityDef().toString())
.addDetail("params", getActivityDef().toString())
.build()
);
}
@@ -131,7 +131,7 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
.element(this)
.interval(this.startedAt, this.stoppedAt)
.layer(Layer.Activity)
.detail("params", getActivityDef().toString())
.addDetail("params", getActivityDef().toString())
.build()
);
}
@@ -400,8 +400,8 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
.element(this)
.now()
.layer(Layer.Activity)
.detail("event", "start-activity")
.detail("params", activityDef.toString())
.addDetail("event", "start-activity")
.addDetail("params", activityDef.toString())
.build());
try {
@@ -520,7 +520,7 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
.element(this)
.now()
.layer(Layer.Activity)
.detail("params", getActivityDef().toString())
.addDetail("params", getActivityDef().toString())
.build()
);
@@ -562,8 +562,8 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
.element(this)
.interval(startedAt, stoppedAt)
.layer(Layer.Activity)
.detail("event", "stop-activity")
.detail("params", activityDef.toString())
.addDetail("event", "stop-activity")
.addDetail("params", activityDef.toString())
.build());
}

View File

@@ -252,7 +252,7 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
.element(this)
.now()
.layer(Layer.Scenario)
.detail("engine", engine.toString())
.addDetail("engine", engine.toString())
.build()
);
@@ -351,7 +351,7 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
.element(this)
.interval(startedAtMillis, this.endedAtMillis)
.layer(Layer.Scenario)
.detail("event","stop-scenario")
.addDetail("event","stop-scenario")
.build();
Annotators.recordAnnotation(annotation);

View File

@@ -37,20 +37,20 @@ import java.util.function.Function;
public interface Annotation extends NBLabeledElement {
/**
* If this is the same as {@link #getEnd()}, then the annotation is
* If this is the same as {@link #getEndMillis()}, then the annotation is
* for an instant in time.
*
* @return The beginning of the interval of time that the annotation describes
*/
long getStart();
long getStartMillis();
/**
* If this is the same as {@link #getStart()}, then the annotation
* If this is the same as {@link #getStartMillis()}, then the annotation
* is for an instant in time.
*
* @return The end of the interval of time that the annotation describes
*/
long getEnd();
long getEndMillis();
/**
* Annotations must be associated with a processing layer in NoSQLBench.
@@ -96,4 +96,8 @@ public interface Annotation extends NBLabeledElement {
String asJson();
default long getDurationMillis() {
return getEndMillis()-getStartMillis();
}
}

View File

@@ -71,7 +71,7 @@ public class AnnotationBuilder implements AnnotationBuilderFacets.All {
@Override
public AnnotationBuilderFacets.WantsMoreDetailsOrBuild detail(String name, String value) {
public AnnotationBuilderFacets.WantsMoreDetailsOrBuild addDetail(String name, String value) {
this.details.put(name, value);
return this;
}

View File

@@ -56,7 +56,7 @@ public interface AnnotationBuilderFacets {
}
interface WantsMoreDetailsOrBuild {
WantsMoreDetailsOrBuild detail(String name, String value);
WantsMoreDetailsOrBuild addDetail(String name, String value);
Annotation build();
}

View File

@@ -68,8 +68,8 @@ public class MutableAnnotation implements Annotation {
setElement(element);
setSession(session);
setLayer(layer);
setStart(start);
setEnd(end);
setStartMillis(start);
setEndMillis(end);
setDetails(details);
}
@@ -82,12 +82,13 @@ public class MutableAnnotation implements Annotation {
this.session = sessionName;
}
public void setStart(long intervalStart) {
public void setStartMillis(long intervalStart) {
this.start = intervalStart;
}
public void setEnd(long intervalEnd) {
public void setEndMillis(long intervalEnd) {
this.end = intervalEnd;
this.details.put("duration",String.valueOf(getDurationMillis()));
}
public void setLayer(Layer layer) {
@@ -99,12 +100,12 @@ public class MutableAnnotation implements Annotation {
}
@Override
public long getStart() {
public long getStartMillis() {
return start;
}
@Override
public long getEnd() {
public long getEndMillis() {
return end;
}
@@ -136,14 +137,14 @@ public class MutableAnnotation implements Annotation {
public String toString() {
StringBuilder sb = new StringBuilder();
ZonedDateTime startTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getStart()), zoneid);
ZonedDateTime endTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getStart()), zoneid);
ZonedDateTime startTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getStartMillis()), zoneid);
ZonedDateTime endTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getStartMillis()), zoneid);
sb.append("[");
ZonedDateTime zonedStartTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getStart()), zoneid);
ZonedDateTime zonedStartTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getStartMillis()), zoneid);
sb.append(zonedStartTime.format(DateTimeFormatter.ISO_INSTANT));
if (getStart() != getEnd()) {
ZonedDateTime zonedEndTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getEnd()), zoneid);
if (getStartMillis() != getEndMillis()) {
ZonedDateTime zonedEndTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(getEndMillis()), zoneid);
sb.append(" - ").append(zonedEndTime.format(DateTimeFormatter.ISO_INSTANT));
}
sb.append("]\n");
@@ -178,7 +179,7 @@ public class MutableAnnotation implements Annotation {
}
public Temporal getTemporal() {
return (getStart() == getEnd()) ? Temporal.instant : Temporal.interval;
return (getStartMillis() == getEndMillis()) ? Temporal.instant : Temporal.interval;
}
public String asJson() {

View File

@@ -34,9 +34,9 @@ public class AnnotationBuilderTest {
.element(NBLabeledElement.forKV("test_element","value"))
.at(time)
.layer(Layer.Scenario)
.detail("detailk1", "detailv1")
.detail("detailk2", "detailv21\ndetailv22")
.detail("detailk3", "v1\nv2\nv3\n")
.addDetail("detailk1", "detailv1")
.addDetail("detailk2", "detailv21\ndetailv22")
.addDetail("detailk3", "v1\nv2\nv3\n")
.build();
String represented = an1.toString();