我在Digital Ocean上安装FreeBSD 11.1,然后安装mongodb34。 我尝试的pkg和端口版本,但对于这两个性能是非常糟糕的相比Ubuntu下相同的设置,10s与0.6s为我的查询。
我已经尝试freebsd提供的3.2版本,并从Wired Tiger切换回MMAPv1。 数据库以最小的configuration运行,日志文件中没有错误。
基准设置FreeBSD:
脚本运行时14,2s
基准设置Ubuntu:
脚本运行时间1,6s
在freebsd上,我已经改变了proc的限制,摆脱了警告,但没有提高速度。 而增加更多的RAM / CPU功率并不是真正的区别。
loggingFreebsd
2017-10-17T07:15:07.610+0000 I CONTROL [initandlisten] MongoDB starting : pid=1152 port=27017 dbpath=/data/db 64-bit host=freebsd-1gb-fra1-01 2017-10-17T07:15:07.612+0000 I CONTROL [initandlisten] db version v3.4.7 2017-10-17T07:15:07.612+0000 I CONTROL [initandlisten] git version: cf38c1b8a0a8dca4a11737581beafef4fe120bcd 2017-10-17T07:15:07.612+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k-freebsd 26 Jan 2017 2017-10-17T07:15:07.612+0000 I CONTROL [initandlisten] allocator: system 2017-10-17T07:15:07.613+0000 I CONTROL [initandlisten] modules: none 2017-10-17T07:15:07.613+0000 I CONTROL [initandlisten] build environment: 2017-10-17T07:15:07.613+0000 I CONTROL [initandlisten] distarch: x86_64 2017-10-17T07:15:07.613+0000 I CONTROL [initandlisten] target_arch: x86_64 2017-10-17T07:15:07.613+0000 I CONTROL [initandlisten] options: { operationProfiling: { mode: "slowOp", slowOpThresholdMs: 1 } } 2017-10-17T07:15:07.616+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'. 2017-10-17T07:15:07.616+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0), 2017-10-17T07:15:09.672+0000 I CONTROL [initandlisten] 2017-10-17T07:15:09.675+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2017-10-17T07:15:09.676+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2017-10-17T07:15:09.676+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. 2017-10-17T07:15:09.677+0000 I CONTROL [initandlisten] 2017-10-17T07:15:09.718+0000 I CONTROL [initandlisten] 2017-10-17T07:15:09.831+0000 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 5734 processes, 28467 files. Number of processes should be at least 14233.5 : 0.5 times number of files. 2017-10-17T07:15:10.042+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data' 2017-10-17T07:15:10.228+0000 I NETWORK [thread1] waiting for connections on port 27017 2017-10-17T07:16:17.910+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:11214 #1 (1 connection now open) 2017-10-17T07:16:17.913+0000 I NETWORK [conn1] received client metadata from 127.0.0.1:11214 conn1: { driver: { name: "PyMongo", version: "3.5.1" }, os: { type: "FreeBSD", name: "FreeBSD 11.1-RELEASE", architecture: "amd64", version: "FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 [email protected]:/usr/obj/usr/src/sys/GENERIC" }, platform: "CPython 2.7.13.final.0" } 2017-10-17T07:16:17.915+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:23489 #2 (2 connections now open) 2017-10-17T07:16:17.916+0000 I NETWORK [conn2] received client metadata from 127.0.0.1:23489 conn2: { driver: { name: "PyMongo", version: "3.5.1" }, os: { type: "FreeBSD", name: "FreeBSD 11.1-RELEASE", architecture: "amd64", version: "FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 [email protected]:/usr/obj/usr/src/sys/GENERIC" }, platform: "CPython 2.7.13.final.0" } 2017-10-17T07:16:21.679+0000 I COMMAND [conn2] command bench.lakes command: find { find: "lakes", sort: { images: -1, fact_area: -1 }, filter: { $and: [ { $or: [ { name: /^bigge$/i }, { alt_names: /^bigge$/i } ] } ] } } planSummary: COLLSCAN keysExamined:0 docsExamined:53257 hasSortStage:1 cursorExhausted:1 numYields:591 nreturned:0 reslen:99 locks:{ Global: { acquireCount: { r: 1184 } }, Database: { acquireCount: { r: 592 } }, Collection: { acquireCount: { r: 592 } } } protocol:op_query 3760ms 2017-10-17T07:16:24.710+0000 I COMMAND [conn2] command bench.lakes command: find { find: "lakes", sort: { images: -1, fact_area: -1 }, filter: { $and: [ { $or: [ { name: /bigge/i }, { alt_names: /bigge/i } ] } ] }, limit: 200 } planSummary: COLLSCAN keysExamined:0 docsExamined:53257 hasSortStage:1 cursorExhausted:1 numYields:543 nreturned:3 reslen:7349 locks:{ Global: { acquireCount: { r: 1088 } }, Database: { acquireCount: { r: 544 } }, Collection: { acquireCount: { r: 544 } } } protocol:op_query 3018ms 2017-10-17T07:16:33.952+0000 I COMMAND [conn2] command bench.places command: count { count: "places", query: { country_code: "DE", place_name: /(\bbigge\b)/i } } planSummary: COLLSCAN keysExamined:0 docsExamined:586684 numYields:4962 reslen:44 locks:{ Global: { acquireCount: { r: 9926 } }, Database: { acquireCount: { r: 4963 } }, Collection: { acquireCount: { r: 4963 } } } protocol:op_query 9233ms 2017-10-17T07:16:34.323+0000 I - [conn1] end connection 127.0.0.1:11214 (2 connections now open) 2017-10-17T07:16:34.336+0000 I - [conn2] end connection 127.0.0.1:23489 (1 connection now open)
loggingUbuntu
2017-10-17T07:40:37.954+0000 I CONTROL [initandlisten] MongoDB starting : pid=12595 port=27017 dbpath=/data/db 64-bit host=mongodb-1gb-fra1-01 2017-10-17T07:40:37.954+0000 I CONTROL [initandlisten] db version v3.4.7 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] git version: cf38c1b8a0a8dca4a11737581beafef4fe120bcd 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] allocator: tcmalloc 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] modules: none 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] build environment: 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] distmod: ubuntu1604 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] distarch: x86_64 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] target_arch: x86_64 2017-10-17T07:40:37.955+0000 I CONTROL [initandlisten] options: { operationProfiling: { mode: "slowOp", slowOpThresholdMs: 1 } } 2017-10-17T07:40:37.995+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'. 2017-10-17T07:40:37.995+0000 I STORAGE [initandlisten] 2017-10-17T07:40:37.995+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 2017-10-17T07:40:37.995+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem 2017-10-17T07:40:37.995+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0), 2017-10-17T07:40:38.391+0000 I CONTROL [initandlisten] 2017-10-17T07:40:38.391+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2017-10-17T07:40:38.391+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2017-10-17T07:40:38.391+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. 2017-10-17T07:40:38.392+0000 I CONTROL [initandlisten] 2017-10-17T07:40:38.392+0000 I CONTROL [initandlisten] 2017-10-17T07:40:38.392+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2017-10-17T07:40:38.392+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never' 2017-10-17T07:40:38.393+0000 I CONTROL [initandlisten] 2017-10-17T07:40:38.393+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. 2017-10-17T07:40:38.393+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never' 2017-10-17T07:40:38.393+0000 I CONTROL [initandlisten] 2017-10-17T07:40:38.407+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data' 2017-10-17T07:40:38.407+0000 I NETWORK [thread1] waiting for connections on port 27017 2017-10-17T07:40:41.911+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:57464 #1 (1 connection now open) 2017-10-17T07:40:41.913+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:57466 #2 (2 connections now open) 2017-10-17T07:40:42.326+0000 I COMMAND [conn2] command bench.lakes command: find { find: "lakes", sort: { images: -1, fact_area: -1 }, filter: { $and: [ { $or: [ { name: /^bigge$/i }, { alt_names: /^bigge$/i } ] } ] } } planSummary: COLLSCAN keysExamined:0 docsExamined:53257 hasSortStage:1 cursorExhausted:1 numYields:418 nreturned:0 reslen:99 locks:{ Global: { acquireCount: { r: 838 } }, Database: { acquireCount: { r: 419 } }, Collection: { acquireCount: { r: 419 } } } protocol:op_query 412ms 2017-10-17T07:40:42.533+0000 I COMMAND [conn2] command bench.lakes command: find { find: "lakes", sort: { images: -1, fact_area: -1 }, filter: { $and: [ { $or: [ { name: /bigge/i }, { alt_names: /bigge/i } ] } ] }, limit: 200 } planSummary: COLLSCAN keysExamined:0 docsExamined:53257 hasSortStage:1 cursorExhausted:1 numYields:417 nreturned:3 reslen:7349 locks:{ Global: { acquireCount: { r: 836 } }, Database: { acquireCount: { r: 418 } }, Collection: { acquireCount: { r: 418 } } } protocol:op_query 203ms 2017-10-17T07:40:43.492+0000 I COMMAND [conn2] command bench.places command: count { count: "places", query: { country_code: "DE", place_name: /(\bbigge\b)/i } } planSummary: COLLSCAN keysExamined:0 docsExamined:586684 numYields:4588 reslen:44 locks:{ Global: { acquireCount: { r: 9178 } }, Database: { acquireCount: { r: 4589 } }, Collection: { acquireCount: { r: 4589 } } } protocol:op_query 957ms 2017-10-17T07:40:43.930+0000 I - [conn1] end connection 127.0.0.1:57464 (2 connections now open) 2017-10-17T07:40:43.930+0000 I - [conn2] end connection 127.0.0.1:57466 (1 connection now open)