Skip to content

Commit 8c35f3b

Browse files
author
danny-hazelcast
committed
IgnitePutBenchmakrByte
1 parent 132760e commit 8c35f3b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.ignite.Ignition;
2525
import org.apache.ignite.events.Event;
2626
import org.apache.ignite.lang.IgnitePredicate;
27+
import org.apache.ignite.yardstick.cache.model.SampleValue;
2728
import org.yardstickframework.BenchmarkConfiguration;
2829
import org.yardstickframework.BenchmarkDriverAdapter;
2930
import org.yardstickframework.BenchmarkUtils;
@@ -48,6 +49,8 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter {
4849

4950
jcommander(cfg.commandLineArguments(), args, "<ignite-driver>");
5051

52+
SampleValue.sampleValueSize = cfg.valueSize();
53+
5154
if (Ignition.state() != IgniteState.STARTED) {
5255
node = new IgniteNode(args.isClientOnly() && !args.isNearCache());
5356

src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public class SampleValue implements Externalizable, Binarylizable {
3333
/** */
3434
private int id;
3535

36+
public static int sampleValueSize=1001;
37+
private byte[] value = new byte[sampleValueSize];
38+
3639
/** */
3740
public SampleValue() {
3841
// No-op.
@@ -59,24 +62,43 @@ public int getId() {
5962
return id;
6063
}
6164

65+
/**
66+
* @param id value.
67+
*/
68+
public void setValue(byte[] value) {
69+
this.value = value;
70+
}
71+
72+
/**
73+
* @return value.
74+
*/
75+
public byte[] getValue() {
76+
return value;
77+
}
78+
79+
6280
/** {@inheritDoc} */
6381
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
6482
id = in.readInt();
83+
in.read(value);
6584
}
6685

6786
/** {@inheritDoc} */
6887
@Override public void writeExternal(ObjectOutput out) throws IOException {
6988
out.writeInt(id);
89+
out.write(value);
7090
}
7191

7292
/** {@inheritDoc} */
7393
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
7494
writer.writeInt("id", id);
95+
writer.writeByteArray("value", value);
7596
}
7697

7798
/** {@inheritDoc} */
7899
@Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
79100
id = reader.readInt("id");
101+
value = reader.readByteArray("value");
80102
}
81103

82104
/** {@inheritDoc} */

0 commit comments

Comments
 (0)