Я хотел бы провести стресс-тест моего сервера MongoDB 4.2 с помощью Jmeter. Прямо сейчас я не использую какую-либо конкретную конфигурацию, я просто запускаю экземпляр mongod на localhost.
Я следовал этому руководству, чтобы настроить jmeter: https://www.blazemeter.com/blog/mongodb-performance-testing-with-jmeter. Однако я не могу правильно выполнить следующий тест:
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import static com.mongodb.client.model.Filters.*;
import org.bson.Document;
import org.bson.types.ObjectId;
import java.util.Arrays;
try{
MongoClient mongoClient = MongoClients.create();
MongoDatabase database = mongoClient.getDatabase(vars.get("databaseName"));
MongoCollection<Document> collection = database.getCollection(vars.get("collectionName"));
Document document = new Document("_id", 7);
collection.insertOne(document);
}
catch (Exception e){
SampleResult.setSuccessful(false);
SampleResult.setResponseCode("500");
SampleResult.setResponseMessage("Exception: " + e);
}
из-за этой ошибки:
2020-05-29 14:30:07,987 INFO o.m.d.cluster: Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoException: org.bson.BsonSerializationException: Detected unknown BSON type "\x7b" for fieldname "^A". Are you using the latest driver version?
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:138) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) [mongo-java-driver-3.12.4.jar:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.bson.BsonSerializationException: Detected unknown BSON type "\x7b" for fieldname "^A". Are you using the latest driver version?
at org.bson.BsonBinaryReader.readBsonType(BsonBinaryReader.java:96) ~[bson-3.12.4.jar:?]
at com.mongodb.internal.connection.ProtocolHelper.getField(ProtocolHelper.java:147) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.ProtocolHelper.getOperationTime(ProtocolHelper.java:102) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.InternalStreamConnection.updateSessionContext(InternalStreamConnection.java:537) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:301) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:259) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:105) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62) ~[mongo-java-driver-3.12.4.jar:?]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129) ~[mongo-java-driver-3.12.4.jar:?]
... 2 more
Я пробовал следующие комбинации драйверов MongoDB Java (в обоих jmeter / lib и jmeter / lib / ext папки):
- mongodb-driver-core.jar, mongodb-driver-syn c .jar и bson.jar (обе версии 4.0.3 и 3.12 .3)
- mon go - java -driver.jar и bson.jar (версия 3.12.4)
Вы можете помочь мне разобраться, в чем проблема?