Skip to content

Commit

Permalink
refactor: moved some legacy benchmark logic to specific module
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Jan 15, 2025
1 parent 6f7eb80 commit c9ebf35
Show file tree
Hide file tree
Showing 73 changed files with 164 additions and 562 deletions.
100 changes: 100 additions & 0 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ /*
~ * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
~ *
~ * Licensed under the Apache License, Version 2.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ *
~ * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS,
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ * See the License for the specific language governing permissions and
~ * limitations under the License.
~ *
~ * For more information: http://www.orientechnologies.com
~ */
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>orientdb-benchmarks</artifactId>

<name>OrientDB Benchmarks</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>
</properties>

<dependencies>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-test-commons</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>java17</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<properties>
<argLine>
-Xmx${heapSize}
-Dstorage.diskCache.bufferSize=4096
-Dmemory.directMemory.trackMode=true
-Djava.util.logging.manager=com.orientechnologies.common.log.ShutdownLogManager
-Dstorage.diskCache.checksumMode=storeAndThrow
-Dsecurity.warningDefaultUsers=false
--add-opens jdk.unsupported/sun.misc=ALL-UNNAMED
--add-opens java.base/sun.security.x509=ALL-UNNAMED
</argLine>
</properties>
</profile>
<profile>
<id>secondary-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<includes>
<include>**/*ST.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.orientechnologies.common.test;

import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.db.OrientDB;
import com.orientechnologies.orient.core.db.OrientDBConfig;
import org.junit.After;
import org.junit.Before;

public class BaseMemoryDatabase {

protected ODatabaseSession db;
protected OrientDB context;
private String databaseName;

@Before
public void beforeTest() {
context = new OrientDB("embedded:", OrientDBConfig.defaultConfig());
String dbName = this.getClass().getSimpleName();
dbName = dbName.replace('[', '_');
dbName = dbName.replace(']', '_');
this.databaseName = dbName;
context
.execute(
"create database "
+ this.databaseName
+ " memory users(admin identified by 'adminpwd' role admin) ")
.close();
db = context.open(this.databaseName, "admin", "adminpwd");
}

protected void reOpen(String user, String password) {
this.db.close();
this.db = context.open(this.databaseName, user, password);
}

@After
public void afterTest() throws Exception {
db.close();
context.drop(databaseName);
context.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import com.orientechnologies.common.test.SpeedTestMonoThread;
import com.orientechnologies.orient.core.Orient;
import org.testng.annotations.Test;

@Test(enabled = false)
public abstract class OrientMonoThreadTest extends SpeedTestMonoThread {
public OrientMonoThreadTest(int iCycles) {
super(iCycles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import com.orientechnologies.common.test.SpeedTestMultiThreads;
import com.orientechnologies.common.test.SpeedTestThread;
import org.testng.annotations.Test;

@Test(enabled = false)
public abstract class OrientMultiThreadTest extends SpeedTestMultiThreads {
public OrientMultiThreadTest(
int iCycles, int iThreads, Class<? extends SpeedTestThread> iThreadClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.orientechnologies.orient.core.index.OIndex;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import org.testng.annotations.Test;

@Test(enabled = false)
public class DictionaryPutDocumentSpeedTest extends OrientMonoThreadTest {
private ODatabaseDocument database;
private ODocument record;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE;
import org.testng.annotations.Test;

@Test
public class FullTextIndexerTest {
private static final int DOCUMENTS = 1000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
import com.orientechnologies.common.serialization.types.OLongSerializer;
import com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import org.testng.annotations.Test;

@Test
public class IntgerSerializationSpeedTest extends OrientMonoThreadTest {

@Test(enabled = false)
public static void main(String[] iArgs) throws InstantiationException, IllegalAccessException {
IntgerSerializationSpeedTest test = new IntgerSerializationSpeedTest();
test.data.go(test);
Expand All @@ -35,11 +32,9 @@ public IntgerSerializationSpeedTest() throws InstantiationException, IllegalAcce
}

@Override
@Test(enabled = false)
public void init() {}

@Override
@Test(enabled = false)
public void cycle() {
BytesContainer container = new BytesContainer();

Expand All @@ -63,6 +58,5 @@ public void cycle() {
}

@Override
@Test(enabled = false)
public void deinit() {}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
package com.orientechnologies.orient.test.database.speed;

import com.orientechnologies.common.test.BaseMemoryDatabase;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.id.ORecordId;
import com.orientechnologies.orient.core.iterator.ORecordIteratorClass;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.test.database.BaseMemoryDatabase;
import org.testng.annotations.Test;

/**
* @author Andrey Lomakin (a.lomakin-at-orientdb.com)
* @since 9/17/14
*/
@Test
public class IteratorSpeedTest extends BaseMemoryDatabase {
public void testIterationSpeed() {

OClass oClass = db.getMetadata().getSchema().createClass("SpeedTest");
for (int i = 0; i < 1000000; i++) {
ODocument document = new ODocument("SpeedTest");
document.save();
db.save(document);
}

ORecordIteratorClass iterator =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import java.util.Date;
import org.testng.annotations.Test;

@Test(enabled = false)
public class LocalCreateAsynchDocumentSpeedTest extends OrientMonoThreadTest {
private ODatabaseDocument database;
private ODocument record;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import java.util.Random;
import org.testng.annotations.Test;

@Test(enabled = false)
public class LocalCreateBinarySpeedTest extends OrientMonoThreadTest {
private ODatabaseDocument database;
private ORecordBytes record;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@
import com.orientechnologies.orient.test.database.base.OrientMultiThreadTest;
import com.orientechnologies.orient.test.database.base.OrientThreadTest;
import java.util.Date;
import org.testng.annotations.Test;

public class LocalCreateDocumentMultiThreadIndexedSpeedTest extends OrientMultiThreadTest {
private ODatabaseDocument database;
private long foundObjects;

@Test(enabled = false)
public static class CreateObjectsThread extends OrientThreadTest {
private ODatabaseDocument database;
private ODocument record;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
import com.orientechnologies.orient.test.database.base.OrientMultiThreadTest;
import com.orientechnologies.orient.test.database.base.OrientThreadTest;
import java.util.Date;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.junit.Assert;

public class LocalCreateDocumentMultiThreadSpeedTest extends OrientMultiThreadTest {
private ODatabaseDocumentInternal mainDatabase;
private long foundObjects;

@Test(enabled = false)
public static class CreateObjectsThread extends OrientThreadTest {
private ODatabaseDocumentInternal database;
private ODocument record;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import java.util.Date;
import org.testng.annotations.Test;

@Test
public class LocalCreateDocumentSpeedTest extends OrientMonoThreadTest {
private ODatabaseDocumentInternal database;
private ODocument record;
Expand All @@ -36,14 +34,12 @@ public LocalCreateDocumentSpeedTest() throws InstantiationException, IllegalAcce
super(1000000);
}

@Test(enabled = false)
public static void main(String[] iArgs) throws InstantiationException, IllegalAccessException {
LocalCreateDocumentSpeedTest test = new LocalCreateDocumentSpeedTest();
test.data.go(test);
}

@Override
@Test(enabled = false)
public void init() {
database = new ODatabaseDocumentTx(System.getProperty("url"));
database.setSerializer(new ORecordSerializerBinary());
Expand All @@ -63,7 +59,6 @@ record = database.newInstance();
}

@Override
@Test(enabled = false)
public void cycle() {
record.reset();

Expand All @@ -80,7 +75,6 @@ public void cycle() {
}

@Override
@Test(enabled = false)
public void deinit() {
System.out.println(Orient.instance().getProfiler().dump());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import java.util.Date;
import org.testng.annotations.Test;

@Test(enabled = false)
public class LocalCreateFlatDocumentSpeedTest extends OrientMonoThreadTest {
private ODatabaseDocument database;
private ODocument record;
Expand All @@ -40,7 +38,6 @@ public LocalCreateFlatDocumentSpeedTest() throws InstantiationException, Illegal
}

@Override
@Test(enabled = false)
public void init() {
Orient.instance().getProfiler().startRecording();

Expand All @@ -54,7 +51,6 @@ record = database.newInstance();
}

@Override
@Test(enabled = false)
public void cycle() {
record.reset();
record.setClassName("Account");
Expand All @@ -73,7 +69,6 @@ public void cycle() {
}

@Override
@Test(enabled = false)
public void deinit() {
if (database != null) database.drop();
super.deinit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE;
import com.orientechnologies.orient.test.database.base.OrientMonoThreadTest;
import org.testng.annotations.Test;

@Test(enabled = false)
public class LocalCreateIndexedDocumentSpeedTest extends OrientMonoThreadTest {
private ODatabaseDocument database;
private ODocument record;
Expand Down
Loading

0 comments on commit c9ebf35

Please sign in to comment.