Neo4j性能测试
声明:本测试基于cypher语句,也就是无论是查询还是修改都是基于cypher语句的,而且本文的查询和修改均为查询出一条边和修改一条边。并且数据的量级也是基于边的关系的。而节点是从这些边中抽出出来之后加上随机属性的
文章目录
测试环境准备
3台节点,每台cpu和内存都差不多
CPU
[root@f1 import]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 40
On-line CPU(s) list: 0-39
Thread(s) per core: 2
Core(s) per socket: 10
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz
Stepping: 4
CPU MHz: 2499.921
CPU max MHz: 3000.0000
CPU min MHz: 800.0000
BogoMIPS: 4400.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 14080K
NUMA node0 CPU(s): 0-9,20-29
NUMA node1 CPU(s): 10-19,30-39
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req
内存
[root@f1 import]# free -m
total used free shared buff/cache available
Mem: 257419 5205 8221 287 243993 250926
Swap: 131071 0 131071
磁盘
[root@f3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 12T 609M 12T 1% /app
测试数据
通过随机函数随机生成的通话记录数据
测试方法
使用neo4j-OGM框架,每次查出相应的关系数据然后,根据关系数据现在的值对其进行更改,然后保存,查询为一条一条地查询,但是保存为每一个事务批次保存100条数据。
每次查询与保存的之前和之后都获取时间戳,然后进行相减,对产生的时间段进行累加。如代码所示保存的样例。
Long updateStart = System.currentTimeMillis();
session.save(updateEntities);
updateCost += System.currentTimeMillis() - updateStart;
100万关系数据测试
导入数据数量
IMPORT DONE in 7s 464ms.
Imported:
1967732 nodes
1000000 relationships
7870928 properties
Peak memory usage: 1.02 GB
没索引情况下
neo4j> match (a:phone{
phone:"132xxxxxx8"})-[b]-(c) return a,b,c;
| (:phone {
province: 24, phone: "132xxxxxx8", city: 26, net_time: "2017-03-12"}) | [:call {
duration: 62, shortest_duration: 31, times: 2, fast_time: "2019-04-04 11:24:05", last_time: "2019-04-04 11:24:05", fast_duration: 31, longest_time: "2019-04-04 11:24:05", longest_duration: 31, last_duration: 31, shortest_time: "2019-04-04 11:24:05"}] | (:phone {
province: 1, phone: "1306xxxxxx6", city: 46, net_time: "2017-03-19"})