mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-02 19:25:52 +08:00
Merge branch 'master' of github.com:apple/foundationdb
This commit is contained in:
commit
4a9b5d95f2
@ -144,6 +144,11 @@ define add_java_binding_targets
|
|||||||
@rm -r packages/jar$(1)_regular
|
@rm -r packages/jar$(1)_regular
|
||||||
@cd bindings && jar uf $$(TOPDIR)/$$@ ../LICENSE
|
@cd bindings && jar uf $$(TOPDIR)/$$@ ../LICENSE
|
||||||
|
|
||||||
|
packages/fdb-java$(1)-$$(JARVER)-tests.jar: fdb_java$(1) versions.target
|
||||||
|
@echo "Building $$@"
|
||||||
|
@rm -f $$@
|
||||||
|
@cp $$(TOPDIR)/bindings/java/foundationdb-tests$(1).jar packages/fdb-java$(1)-$$(JARVER)-tests.jar
|
||||||
|
|
||||||
packages/fdb-java$(1)-$$(JARVER)-sources.jar: $$(JAVA$(1)_GENERATED_SOURCES) versions.target
|
packages/fdb-java$(1)-$$(JARVER)-sources.jar: $$(JAVA$(1)_GENERATED_SOURCES) versions.target
|
||||||
@echo "Building $$@"
|
@echo "Building $$@"
|
||||||
@rm -f $$@
|
@rm -f $$@
|
||||||
@ -165,7 +170,7 @@ define add_java_binding_targets
|
|||||||
@cd packages/bundle$(1)_regular && jar cf $(TOPDIR)/$$@ *
|
@cd packages/bundle$(1)_regular && jar cf $(TOPDIR)/$$@ *
|
||||||
@rm -rf packages/bundle$(1)_regular
|
@rm -rf packages/bundle$(1)_regular
|
||||||
|
|
||||||
fdb_java$(1)_release: packages/fdb-java$(1)-$$(JARVER)-bundle.jar
|
fdb_java$(1)_release: packages/fdb-java$(1)-$$(JARVER)-bundle.jar packages/fdb-java$(1)-$$(JARVER)-tests.jar
|
||||||
|
|
||||||
fdb_java$(1)_release_clean:
|
fdb_java$(1)_release_clean:
|
||||||
@echo "Cleaning Java release"
|
@echo "Cleaning Java release"
|
||||||
|
@ -98,7 +98,6 @@ public abstract class AbstractTester {
|
|||||||
}
|
}
|
||||||
if (args.useExternalClient()) {
|
if (args.useExternalClient()) {
|
||||||
fdb.options().setDisableLocalClient();
|
fdb.options().setDisableLocalClient();
|
||||||
// TODO: set external client directory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -25,7 +25,6 @@ import com.apple.cie.foundationdb.KeySelector;
|
|||||||
import com.apple.cie.foundationdb.Transaction;
|
import com.apple.cie.foundationdb.Transaction;
|
||||||
import com.apple.cie.foundationdb.TransactionContext;
|
import com.apple.cie.foundationdb.TransactionContext;
|
||||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||||
import com.apple.cie.foundationdb.subspace.Subspace;
|
|
||||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -62,6 +61,7 @@ public class PerformanceTester extends AbstractTester {
|
|||||||
SERIAL_GET("Java Completable API serial get throughput"),
|
SERIAL_GET("Java Completable API serial get throughput"),
|
||||||
GET_RANGE("Java Completable API get_range throughput"),
|
GET_RANGE("Java Completable API get_range throughput"),
|
||||||
GET_KEY("Java Completable API get_key throughput"),
|
GET_KEY("Java Completable API get_key throughput"),
|
||||||
|
GET_SINGLE_KEY_RANGE("Java Completable API get_single_key_range throughput"),
|
||||||
ALTERNATING_GET_SET("Java Completable API alternating get and set throughput"),
|
ALTERNATING_GET_SET("Java Completable API alternating get and set throughput"),
|
||||||
WRITE_TRANSACTION("Java Completable API single-key transaction throughput");
|
WRITE_TRANSACTION("Java Completable API single-key transaction throughput");
|
||||||
|
|
||||||
@ -109,6 +109,7 @@ public class PerformanceTester extends AbstractTester {
|
|||||||
Tests.SERIAL_GET.setFunction(db -> serialGet(db, 2_000));
|
Tests.SERIAL_GET.setFunction(db -> serialGet(db, 2_000));
|
||||||
Tests.GET_RANGE.setFunction(db -> getRange(db, 1_000));
|
Tests.GET_RANGE.setFunction(db -> getRange(db, 1_000));
|
||||||
Tests.GET_KEY.setFunction(db -> getKey(db, 2_000));
|
Tests.GET_KEY.setFunction(db -> getKey(db, 2_000));
|
||||||
|
Tests.GET_SINGLE_KEY_RANGE.setFunction(db -> getSingleKeyRange(db, 2_000));
|
||||||
Tests.ALTERNATING_GET_SET.setFunction(db -> alternatingGetSet(db, 2_000));
|
Tests.ALTERNATING_GET_SET.setFunction(db -> alternatingGetSet(db, 2_000));
|
||||||
Tests.WRITE_TRANSACTION.setFunction(db -> writeTransaction(db, 1_000));
|
Tests.WRITE_TRANSACTION.setFunction(db -> writeTransaction(db, 1_000));
|
||||||
}
|
}
|
||||||
@ -345,6 +346,20 @@ public class PerformanceTester extends AbstractTester {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Double getSingleKeyRange(TransactionContext tcx, int count) {
|
||||||
|
return tcx.run(tr -> {
|
||||||
|
tr.options().setRetryLimit(5);
|
||||||
|
long start = System.nanoTime();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
int keyIndex = randomKeyIndex();
|
||||||
|
tr.getRange(key(keyIndex), key(keyIndex + 1)).asList().join();
|
||||||
|
}
|
||||||
|
long end = System.nanoTime();
|
||||||
|
|
||||||
|
return count*1_000_000_000.0/(end - start);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public Double writeTransaction(TransactionContext tcx, int count) {
|
public Double writeTransaction(TransactionContext tcx, int count) {
|
||||||
long start = System.nanoTime();
|
long start = System.nanoTime();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
@ -381,6 +396,7 @@ public class PerformanceTester extends AbstractTester {
|
|||||||
new PerformanceTester().run(args);
|
new PerformanceTester().run(args);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
System.out.println("Could not run test due to malformed arguments.");
|
System.out.println("Could not run test due to malformed arguments.");
|
||||||
|
System.out.println(e.getMessage());
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Fatal error encountered during run: " + e);
|
System.out.println("Fatal error encountered during run: " + e);
|
||||||
|
@ -99,7 +99,7 @@ public class TesterArgs {
|
|||||||
} else if (arg.equals("--enable-callbacks-on-external-threads")) {
|
} else if (arg.equals("--enable-callbacks-on-external-threads")) {
|
||||||
callbacksOnExternalThread = true;
|
callbacksOnExternalThread = true;
|
||||||
} else if (arg.equals("--use-external-client")) {
|
} else if (arg.equals("--use-external-client")) {
|
||||||
externalClient = false;
|
externalClient = true;
|
||||||
} else if (arg.equals("--tests-to-run")) {
|
} else if (arg.equals("--tests-to-run")) {
|
||||||
if (i + 1 < args.length && args[i + 1].charAt(0) != '-') {
|
if (i + 1 < args.length && args[i + 1].charAt(0) != '-') {
|
||||||
int j;
|
int j;
|
||||||
|
@ -47,6 +47,7 @@ class PythonPerformance(PythonTest):
|
|||||||
'serial_get' : 'Python API serial get throughput',
|
'serial_get' : 'Python API serial get throughput',
|
||||||
'get_range' : 'Python API get_range throughput',
|
'get_range' : 'Python API get_range throughput',
|
||||||
'get_key' : 'Python API get_key throughput',
|
'get_key' : 'Python API get_key throughput',
|
||||||
|
'get_single_key_range' : 'Python API get_single_key_range throughput',
|
||||||
'alternating_get_set' : 'Python API alternating get and set throughput',
|
'alternating_get_set' : 'Python API alternating get and set throughput',
|
||||||
'write_transaction' : 'Python API single-key transaction throughput',
|
'write_transaction' : 'Python API single-key transaction throughput',
|
||||||
}
|
}
|
||||||
@ -267,6 +268,17 @@ class PythonPerformance(PythonTest):
|
|||||||
|
|
||||||
return count / (time.time() - s)
|
return count / (time.time() - s)
|
||||||
|
|
||||||
|
@fdb.transactional
|
||||||
|
def run_get_single_key_range(self, tr, count=2000):
|
||||||
|
tr.options.set_retry_limit(5)
|
||||||
|
s = time.time()
|
||||||
|
|
||||||
|
for i in range(count):
|
||||||
|
index = random.randint(0, self.key_count)
|
||||||
|
list(tr[self.key(index):self.key(index+1)])
|
||||||
|
|
||||||
|
return count / (time.time() - s)
|
||||||
|
|
||||||
@fdb.transactional
|
@fdb.transactional
|
||||||
def single_set(self, tr):
|
def single_set(self, tr):
|
||||||
key = self.random_key()
|
key = self.random_key()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user