0
votes

I use ArangoDB on a PC Ubuntu and a Mac for quite a while without any problem. In a general way my Foxx applications worked 4 - 5 times as fast on Mac that on PC.

I passed to the version 2.7.3 on both machines. Now the Mac is slower than the PC. Worse, than the applications are in mode "Production" or "Development", her works in the same speed. I have a doubt concerning the reality of the compilation of the mode "Production". However, the command "foxx-manager list" returns well "true" and "false" according to the chosen mode.

Is there a way to check if the script of an app runs well in compiled mode or not? A suggestion?

3
A few questions back: how do you determine that the app is running "slow" or "fast"? Are you measuring roundtrip times of client calls to the app via HTTP/HTTPS? Is there any network involved or is everything "localhost" everywhere? Does the app code depend on the number of collections or documents, and are you running it on approx. the same data set on both machines? Do the machines have enough memory to keep the working data in RAM?stj
"production" mode means that whether app modules are already loaded via require, and all app routes will stay in cache. "development" mode means that each "require" in your app will actually recompile the module, and app routes will be rebuilt on every HTTP request. This makes your app stay up-to-date, but definitely has an overhead and shouldn't be used in production. But it's unclear to me where all the execution time is spent: in loading the app or in executing the app code? E.g. the bottleneck may be inside the app's code, and may even be unaffected by the production/development setting.stj
I compare the speed by watching parading the logs of both machines at the same time. Both execute the same code with local data (CouchDB - > python - > ArangoDB). Before passing to the version 2.7.3, I had upgrade the Mac to El Capitan. As I had installed ArangoDB with Homebrew I decided yesterday to uninstall everything (CouchDB, ArangoDB, python …) and to start over everything, attentively. Today everything is ready, same code, same data. The result is the same. Slowness. I found no explanation near Homebrew (issues …) Anything near ArangoDB (stackoverflow, Google groups …)pipeult
From the description it's still unclear where the bottleneck is: there's CouchDB, Python and ArangoDB running, and there's a Foxx app with unknown internals. To make the measurement a bit more specific to ArangoDB, is it possible to have a client program (arangosh, curl) issue calls to the Foxx app in ArangoDB only and time them? That should give you an idea of the current throughput, and if you think it's too slow we can look for ways to improve it (however this will likely involve looking at the currently unknown Foxx app code).stj
by default ArangoDB has several V8 contexts which are chosen round robin by the workers. in 2.7 foxx services are loaded on first access, so you may see them taking a little longer for their first access per context. If you want to get compareable numbers, you need to either warm that foxx service by accessing it several times before starting your real test, or set the number of available javascript contexts to 1: --javascript.v8-contexts=1 (not advised for production environments) to know that accessing it once will have all contexts prepared.dothebart

3 Answers

1
votes

I am sorry but I cannot share my data.
Here is the code I use on both machines to test the CouchDB and ArangoDB accesses. It is minimalist, brings in no personal code both on CouchDB and on ArangoDB, uses HTTP and works in local.

import requests
import time

LOOP = 500

CDB_SESS = requests.Session()
CDB_SESS.stream = False
CDB_SESS.headers.update({'content-type': 'application/json; charset=utf-8'})

ADB_SESS = requests.Session()
ADB_SESS.stream = False
ADB_SESS.headers.update({'content-type': 'application/json; charset=utf-8'})

if __name__ == '__main__':
    print 'CouchDB'
    START = time.time()
    for x in range(LOOP):
        _rsp = CDB_SESS.get('http://localhost:5984/')
        value = _rsp.json()
    STOP = time.time()
    print (STOP - START)

    print 'ArangoDB'
    START = time.time()
    for x in range(LOOP):
        _rsp = ADB_SESS.get('http://localhost:8529/_db/_system/_api/version')
        value = _rsp.json()
    STOP = time.time()
    print (STOP - START)

Both loops differ only by the used url. The databases run only internal code, not mine, right?
Is it not reasonable to think that if the bottleneck comes from Python or from Requests, this one acts here in the same way on the two databases?

Today I put aside the PC and worked on the MAC.
I uninstalled ArangoDB (brew uninstall arangodb) and cleaned the directory var/lib of its contents. Then I reinstalled it (brew install arangodb) without transferring my data or any Foxx app. One virgin install. My only operation is to have modified v8-contexts=1.

I launched the test above, 3 times. Here is the result:
- CouchDB: 1.54s, 1.49s, 1.49s
- ArangoDB: 1.05s, 1.04s, 1.05s

The results are identicaly bad as those obtained previously.
Do I have to incriminate my data (not present) or my Foxx app (not present)?

0
votes

I made some tests.
The versions which I use are the same on both machines for:
- CouchDB 1.6.1
- ArangoDB 2.7.3
- requests 2.9.1
except for python:
- PC 2.7.6
- MAC 2.7.11

The codes of tests are identical on both machines. I launch them 3 times, in case. The data on CouchDB and ArangoDB are identical on the PC and the MAC.

The first test is a loop of reading 500 records on CouchDB only (my source):
- on the PC: 53.36s, 53.66s, 53.59s
- on the MAC: 5.70s, 5.86s, 6.01s
The MAC it is 9-10 times as fast. The slowing down does not come from my source of data, right ?

The second test is a loop of 500 'http://localhost:5984/' on CouchDB and 500 'http://localhost:8529/db/ system/_ api/version' on ArangoDB. My code does not intervene, right ?: on the PC:
- CouchDB: 20.02s, 20.01s, 20.01s
- ArangoDB: 0.48s, 0.37s, 0.38s
The difference of speed for 'which is your version ?' is of the order of 40.

on the MAC:
- CouchDB: 1.48s, 1.49s, 1.61s
- ArangoDB: 1.07s, 1.07s, 1.13s
Where is the difference ?

0
votes

After a lot of research & discsions we found out two issues:

  • swagger.io which we use for API-documentation took very long to render in safari; We updated to a more recent version.
  • Apple introduced a performance regression with El Capitans xcode & clang that slow down ArangoDB up to 7 times. Using an older xcode or GCC doesn't produce slow binaries.The latest formular now strongly discourages using clang

Further discussion was held in github issue #1629