Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2BD5618688 for ; Sat, 6 Feb 2016 00:15:28 +0000 (UTC) Received: (qmail 58263 invoked by uid 500); 6 Feb 2016 00:15:27 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 58199 invoked by uid 500); 6 Feb 2016 00:15:27 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 58187 invoked by uid 99); 6 Feb 2016 00:15:27 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Feb 2016 00:15:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D28DBC0D97 for ; Sat, 6 Feb 2016 00:15:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id SyKxWOPjDRdd for ; Sat, 6 Feb 2016 00:15:24 +0000 (UTC) Received: from mail-yw0-f171.google.com (mail-yw0-f171.google.com [209.85.161.171]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 2C6AC2050D for ; Sat, 6 Feb 2016 00:15:24 +0000 (UTC) Received: by mail-yw0-f171.google.com with SMTP id z185so64855017ywf.0 for ; Fri, 05 Feb 2016 16:15:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Nu37ExwHZplHN2PglspufMGsMoG2PEHnJR/QOn9QzcA=; b=YAut4IIfri5Ve8YS2+hJA2HGoqps2Q6KAyiPsmtQbRTLb5goEtOpKQ960nsbBl1ZZw KX+NyUkK0en5T2IYG1U/J5dcO9/IP7V49a73U+/PbnXen1nCnp/fCF2c9bw63ATjpRqJ 2EdoZNWsMDcZeqg9ThWmoTD8cl18j3/rr7JUtyizPIyZyYqyzetcFAsRMpiQh+XhtxxO xxV9DJnmb4249ZIHYjZ7XDP+mC7HiGrwWkhe0zwzw6SPsp6Z2QA4IrdM8MSVNwW3gMe6 b1rgOreclG8uC8rcZyPgCoXDnkku71T5NLHKgBdJrNsMKreFYkNk4Wvc2zxy5ad2PlFe Gq9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Nu37ExwHZplHN2PglspufMGsMoG2PEHnJR/QOn9QzcA=; b=ibS7QDfUmgB64jajH6bCZH+iozHIjzkytfZ3KZkfHrjiNb0CsRm0yjyo4pgGtQ1n/n 4NG1sXxsRbrPgRa/BxMPqaePWwCg7zovYuS9jE+CakdYn7ucGXeyjfz5sJMF7g69xEQR HYUApHXGN4ONE0pmxN1l45FFd6QD+j5TQqjkAKmr3FlxeeDnyj7j8Z1+ZpycHxUIZMus EsbYTLk3ZBRqCDh5g9p/4Fl8q637d2glEjFbk+8AissoV65dZW78DkEmE/W5OUzTLw9U aGhLfLqGfl2acV+aV2V/m8OHKvFinvkBziKKSoi+kDhi140YjTGPk52XLuMP0RjkHcuO NCKw== X-Gm-Message-State: AG10YOS7ZlGKn1pl3SFUg6LRUh6zLxpZnRHJguqKcUgbwwJ/0MaG1YxOdmknaMjYeHP6xj2Qk1guiYWOw6N/tg== MIME-Version: 1.0 X-Received: by 10.13.255.194 with SMTP id p185mr8130124ywf.10.1454717717232; Fri, 05 Feb 2016 16:15:17 -0800 (PST) Received: by 10.129.103.8 with HTTP; Fri, 5 Feb 2016 16:15:17 -0800 (PST) In-Reply-To: References: Date: Fri, 5 Feb 2016 18:15:17 -0600 Message-ID: Subject: Re: Performance using FileDataStore/MySql vs. MongoDB in Oak From: Clay Ferguson To: users@jackrabbit.apache.org Content-Type: multipart/alternative; boundary=94eb2c088930c8c4c6052b0edc09 --94eb2c088930c8c4c6052b0edc09 Content-Type: text/plain; charset=UTF-8 Mark, Right off the top of my head, I'd guess MySql is doing 151 commits somehow. MongoDb will definitely be orders of magnitude faster than MySQL on large numbers of node operations, because it use a 'delayed read', 'delayed write', lazy operation rather than being ACID Commits like RDBMSes do. There may be a setting somewhere to make the MySql do batch operations rather than individual commits. It may even be something as simple as turning off autocommit at the JDBC layer somewhere or something like that. Check and see if there is some logging you can turn on trace-level using log4j options targeting the JDBC classes and see if you can get it to log out all the sql commits/transactions. I moved from MySql to mongo months ago or else I'd be of more help. Best regards, Clay Ferguson wclayf@gmail.com On Fri, Feb 5, 2016 at 4:12 PM, Mark Moales wrote: > Hi, > > We are currently using Jackrabbit 2 in a production application and are > looking to move to Oak. In our Jackrabbit 2 application, we are using > MySql, BundleDbPersistenceManager, and a FileDataStore. When using a > similar configuration with Oak, we are noticing significant performance > issues when removing nodes from the repository. To show the performance > issue, I have created a simple example that creates a single parent node of > nt:unstructured type and then adds 150 more child nodes of the same type. > Each node, including the parent, has 10 properties and has a > mix:referenceable mixin. Here is how I create the DocumentNodeStore: > > MySql: > > static FileStore store; > static FileDataStore fds; > > static void initFileStore() throws IOException { > File testDir = new File("F:\\oak-datastore"); > FileDataStore _fds = new OakFileDataStore(); > _fds.init(testDir.getPath()); > FileStore.Builder fileStoreBuilder = > FileStore.newFileStore(testDir) > .withBlobStore(new DataStoreBlobStore(_fds)) > .withMaxFileSize(256) > .withCacheSize(64) > .withMemoryMapping(false); > store = fileStoreBuilder.create(); > fds = _fds; > } > > static DocumentNodeStore createDocumentNodeStoreMySql() { > System.out.println("Using MySql/FileDataStore"); > String url = "jdbc:mysql://localhost:3306/oak"; > String userName = "root"; > String password = "password"; > String driver = "org.mariadb.jdbc.Driver"; > String prefix = "T" + UUID.randomUUID().toString().replace("-", > ""); > DataSource ds = RDBDataSourceFactory.forJdbcUrl(url, userName, > password, driver); > RDBOptions options = new > RDBOptions().tablePrefix(prefix).dropTablesOnClose(true); > DocumentNodeStore ns = new > DocumentMK.Builder().setAsyncDelay(0).setBlobStore( > new DataStoreBlobStore(fds)).setClusterId(1).setRDBConnection( > ds, options).getNodeStore(); > return ns; > } > > MongoDB: > > static DocumentNodeStore createDocumentNodeStoreMongo() { > System.out.println("Using MongoDB"); > DB db = new MongoClient("127.0.0.1", 27017).getDB("oak"); > DocumentNodeStore ns = new > DocumentMK.Builder().setMongoDB(db).getNodeStore(); > return ns; > } > > And here is how I create the nodes: > > static Node createNodes(Session session) throws RepositoryException { > Node root = session.getRootNode(); > Date start = new Date(); > Node parent = root.addNode("Test", "nt:unstructured"); > totalNodes++; > // > // Commenting out the following line speeds up delete. > // > parent.addMixin("mix:referenceable"); > > for (int p = 0; p < 10; p++) { > parent.setProperty("count" + p, p); > } > for (int i = 0; i < 150; i++) { > createChild(parent, i); > } > session.save(); > Date end = new Date(); > double seconds = (double) (end.getTime() - start.getTime()) / > 1000.00; > System.out.println("Created " + totalNodes + " nodes in " + > seconds + " seconds"); > return parent; > } > > static void createChild(Node parent, int index) > throws RepositoryException { > Node child = parent.addNode("Test" + index, "nt:unstructured"); > totalNodes++; > // > // Commenting out the following line speeds up delete. > // > child.addMixin("mix:referenceable"); > > for (int p = 0; p < 10; p++) { > child.setProperty("count" + p, p); > } > } > > Finally, here is how I remove the parent node: > > static void deleteNodes(Session session, Node parent) throws > RepositoryException { > Date start = new Date(); > parent.remove(); > session.save(); > Date end = new Date(); > double seconds = (double) (end.getTime() - start.getTime()) / > 1000.00; > System.out.println("Deleted " + totalNodes + " nodes in " + > seconds + " seconds"); > } > > When I run using MongoDB: > > Using MongoDB > Created 151 nodes in 0.31 seconds > Deleted 151 nodes in 0.341 seconds > > When I run using MySql/FileDataStore: > > Using MySql/FileDataStore > Created 151 nodes in 0.391 seconds > Deleted 151 nodes in 10.946 seconds > > As you can see, deleting the nodes is quite slow using > MySql/FileDataStore. Using Jackrabbit 2, a similar type of operation using > MySql and file data store takes approximately 1 second. Can anyone shed > any light on why it is taking so long to remove the nodes? Is there > something I should be doing differently when creating the DocumentNodeStore? > > Thanks, > > Mark > > --94eb2c088930c8c4c6052b0edc09--