Building AQL Query Strings: Tips and Best Practices | ArangoDB Blog

I recently wrote two recipes about generating AQL query strings. They are contained in the ArangoDB cookbook by now:

After that, Github user tracker1 suggested in Github issue 1457 to take the ES6 template string variant even further, using a generator function for string building, and also using promises and ES7 async/await.

We can’t use ES7 async/await in ArangoDB at the moment due to lacking support in V8, but the suggested template string generator function seemed to be an obvious improvement that deserved inclusion in ArangoDB.

Basically, the suggestion is to use regular JavaScript variables/expressions in the template string and have them substituted safely.

With regular AQL bind parameters, a query looks like this:

var bindVars = { name: "test" };
var query = `FOR doc IN collection 
         FILTER doc.name == @name 
         RETURN doc._key`;
db._query(query, bindVars);

This is immune to parameter injection, because the query string and the bind parameter value are passed in separately. But it’s not very ES6-y.

(more…)

More info...

ArangoDB Weekly 33: V8 Upgrade and ArangoDB 2.6.7 Highlights

In the last two weeks we’ve fixed some issues, upgraded the bundled V8 version in ArangoDB and released the maintenance release 2.6.5 and 2.6.7 . Besides that we continued our efforts to enhance our indexing capabilities and startet further cluster tests.

ArangoDB Release

The next maintenance release for ArangoDB 2.6 is available for download. You can find a full list of changes in our change-log (2.6.7) and change-log (2.6.5).

Download ArangoDB 2.6.7

ArangoDB related (Drivers & more)

  • (Elasticsearch) elasticsearch-river-arangodb: River Plugin for ElasticSearch, now builds against ES 1.7 (Patrick Huber)
  • (PHP) zend-arangodb-auth (early stage): provides auth and acl for zend framework (Cyberrebell)
  • (Python) python-arango (2.0.0): API call methods for user management and monitoring (Joohwan Oh)
  • (vert.x) vertx-arango-client (early stage): ArangoDB client library built with vert.x. (Craig G)

(more…)

More info...

ArangoDB 2.6.7: Maintenance Release Overview | ArangoDB Blog

A new maintenance release 2.6.7 is available for download.

Changelog:

  • Improved edge index performance when using collections with more than 100 Mio. edges
  • added startup option --server.additional-threads to create separate queues for slow requests.
More info...

ArangoDB 2.6.5: Maintenance Release Highlights | ArangoDB Blog

ArangoDB 2.6.5 is available for download. This is a bugfix release that solves the following issues:

  • fixed busy wait loop in scheduler threads that sometimes consumed 100% CPU while waiting for events on connections closed unexpectedly by the client side
  • handle attribute indexBuckets when restoring collections via arangorestore. Previously the indexBuckets attribute value from the dump was ignored, and the server default value for indexBuckets was used when restoring a collection.
  • fixed “EscapeValue already set error” crash in V8 actions that might have occurred when cancelling V8-based operations.
More info...

ArangoDB Weekly 32: Updates, Tips, and Community Highlights

In the past two weeks we’ve celebrated some lock-hunting days, trying to eliminate read/write locks to enhance throughput . Furthermore, we did some large cluster tests on GCE, which will be continued over the next days. A maintenance release of ArangoDB 2.6, released earlier this week, comes with a new V8 engine.

ArangoDB Releases

Two maintenance releases are available. ArangoDB 2.5.7 and ArangoDB 2.6.4 use an upgraded V8 engine (4.1.0.27).

Download ArangoDB 2.6.4

Articles and Presentations

(more…)

More info...

Efficient Lock-Free Data Structure Protection | ArangoDB Blog

Motivation

In multi-threaded applications running on multi-core systems, it occurs often that there are certain data structures, which are frequently read but relatively seldom changed. An example of this would be a database server that has a list of databases that changes rarely, but needs to be consulted for every single query hitting the database. In such situations one needs to guarantee fast read access as well as protection against inconsistencies, use after free and memory leaks.

Therefore we seek a lock-free protection mechanism that scales to lots of threads on modern machines and uses only C++11 standard library methods. The mechanism should be easy to use and easy to understand and prove correct. This article presents a solution to this, which is probably not new, but which we still did not find anywhere else.

The concrete challenge at hand

Assume a global data structure on the heap and a single atomic pointer P to it. If (fast) readers access this completely unprotected, then a (slow) writer can create a completely new data structure and then change the pointer to the new structure with an atomic operation. Since writing is not time critical, one can easily use a mutex to ensure that there is only a single writer at any given time. The only problem is to decide, when it is safe to destruct the old value, because the writer cannot easily know that no reader is still accessing the old values. The challenge is aggravated by the fact that without thread synchronization it is unclear, when a reader actually sees the new pointer value, in particular on a multi-core machine with a complex system of caches.

If you want to see our solution directly, scroll down to “Source code links“. We first present a classical good approach and then try to improve on it. (more…)

More info...

Throughput Enhancements: Boosting ArangoDB Performance

We’ve recently been working on improving ArangoDB’s throughput, especially when using the ArangoDB’s interface.

In this post, I will show some of the improvements already achieved, though the work is not yet finished. Therefore, the results shown here are still somewhat preliminary.

We wanted to measure improvements for ArangoDB’s HTTP interface, and so we used wrk as an external HTTP load generator.

During the tests, wrk called some specific URLs on a local ArangoDB instance on an otherwise idle machine. The test was run with ArangoDB 2.6 and devel. The ArangoDB instances were started with their default configuration.

wrk was invoked with varying amounts of client connections and threads, so the tests cover serial and concurrent/parallel requests:

bash invoking wrk

wrk -c $CONNECTIONS -t $THREADS -d 10 $URL

The number of connections ($CONNECTIONS) and threads ($THREADS) were both varied from 1 to 8. wrk requires at least as many connections as threads.

(more…)

More info...

ArangoDB 2.6.4: Maintenance Release Overview | ArangoDB Blog

ArangoDB Version 2.6.4 comes with an upgraded V8 engine (4.1.0.27) and is ready to download now. In the 2.5 branch we’ve published a 2.5.7 maintenance release as well.

arangodb.com/download

More info...

Running V8 Isolates in Multi-Threaded ArangoDB

ArangoDB allows running user-defined JavaScript code in the database. This can be used for more complex, stored procedures-like database operations. Additionally, ArangoDB’s Foxx framework can be used to make any database functionality available via an HTTP REST API. It’s easy to build data-centric microservices with it, using the scripting functionality for tasks like access control, data validation, sanitation etc.

We often get asked how the scripting functionality is implemented under the hood. Additionally, several people have asked how ArangoDB’s JavaScript functionality relates to node.js.

This post tries to explain that in detail.

(more…)

More info...

Arango Weekly 31: Official Docker Repo & New Release 2.6.3

ArangoDB is now an Official Repo in the Docker Hub, one of just four additions in the last 2 months. Please try and tell your friends! ArangoDB 2.6 is known as a performance release and we’ve continued to improve the core by killing locks and optimizing code. Looks like we can show some impressive performance boosts soon. Furthermore, Mike Williamson wrote a blog post on modeling data with ArangoDB last week, that is worth to read.

Follow ArangoDB on LinkedIn and add ArangoDB as a skill. We would appreciate your help. Keep an eye on our blog or follow us on Twitter for news about ArangoDB.

(more…)

More info...

Get the latest tutorials,
blog posts and news: