Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
So when I connect to a MongoDB with multiple hosts, there is a delay in every one minute when executing a command. The delay time is exactly 10 seconds. I know this sounds so weird.
First I thought that the problem is related to MongoDB server configuration. But it only happens when I use PHP mongodb driver because it works fine when I tested with Java mongodb driver. - MongoDB Server: 3.6 - PHP mongodb driver: 1.5.3 - Java mongodb driver: 3.10.1
I also tested older version of PHP mongodb driver with the same problem.
PHP
// start tracking reading time $start = microtime(true); $m = new \MongoDB\Client('mongodb://rs1.host.com,rs2.host.com'); $db = $m->selectDatabase('test'); // slow when querying $db->selectCollection('user')->findOne(); // end tracking reading time $end = microtime(true); $duration = $end - $start;
Full source code: https://drive.google.com/open?id=1r-EKiCntZbUq59sFzaBOiCrfy0tzjadt
Java
Date date1 = new Date(); long start = date1.getTime(); MongoClient mongoClient = MongoClients.create("mongodb://rs1.host.com,rs2.host.com"); MongoDatabase db = mongoClient.getDatabase("ple"); db.getCollection("user").find().first(); Date date2 = new Date(); long end = date2.getTime(); System.out.println((end - start) + "ms");
Full source code: https://drive.google.com/open?id=1TYTFrRxUiQUZdIUJdetllHpnOYHQiepd
I repeated the script above every 2 seconds, so here is result I tested:
0.013s 0.0056s 0.0135s 0.0052s 10.0271s (54sec from last delay) 0.0057s 0.0059s 0.0122s 0.0108s 0.0106s 0.0133s 0.014s 0.0095s 0.0076s 0.0145s 0.0102s 0.0148s 0.0058s 0.0132s 0.0125s 0.0134s 0.0056s 0.0055s 0.0135s 0.0124s 0.0116s 0.013s 0.013s 0.0139s 0.0135s 0.0132s 10.0234s (52sec from last delay) 0.0125s 0.0128s 0.0168s 0.0121s 0.0131s 0.0134s 0.0141s 0.0128s 0.0128s 0.0123s 0.0131s 0.0156s 0.006s 0.0053s 0.0058s 0.0136s 0.0131s 0.0139s 0.0131s 0.0063s 0.0125s 0.0127s 0.013s 0.0061s 0.0058s 10.015s (52sec from last delay) 0.0071s 0.0144s
16ms 17ms 17ms 16ms 19ms 17ms 16ms 17ms 16ms 17ms 17ms 16ms 17ms 16ms 16ms 16ms REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.