当前位置:网站首页>Neo4j---性能优化
Neo4j---性能优化
2022-06-30 03:03:00 【抹香鲸之海】
一、基础调优
1、cql语句性能排查
(1)EXPLAIN + 执行的cql语句
仅仅查看执行计划,不执行语句
(2)PROFILE + 执行的cql语句
运行语句,并全程监督资源使用情况
(3)查看索引创建情况
:schema
2、 使用建议
1)相关主键创建索引 语法格式CREATE INDEX ON: 标签(待查字段);
①模式索引:模式索引和关系数据库中的索引很相似, 每一个索引会对应一个标签和一组属性,无论是更新还是删除节点,索引都会自动更新或者删除,因此该种创建索引的方式更适用。
注意:索引状态是ONLINE才能生效,否则刚刚建的索引是无效的。
2)创建唯一索引,避免数据入库检查,造成性能浪费(可以在入库之前校验好数据的完整性和唯一性)CREATE CONSTRAINT ON (n:ResNode) ASSERT n.id IS UNIQUE;
3)create 和 merge的区别 MERGE命令是CREATE命令和MATCH命令的组合。 MERGE = CREATE + MATCH 故新增节点尽量避免merge;
4)不必要的数据,尽可能早的过滤掉,减少后期处理的数据量;
5)避免返回整个节点,返回其中需要的数据。
二、优化neo4j配置文件
对neo4j.conf文件并进行相应修改。通过添加jvm虚拟环境可以提高数据库的查询速度,即取消neo4j配置文件中关于dbms.memory.heap.initial_size=512m;dbms.memory.heap.max_size=512m两行的注释,并做合适的修改(最大堆内存越大越好,但是要小于机器的物理内存)。
三、进阶方案解决性能问题
1、合理引入中间件
eg:涉及内容关键字检索,可以使用elasticSearch,避免直接从neo4j搜索查询,若能结合redis及内存缓存获取详细资源信息,搜索只返回主键,还能进一步提交查询效率,用户体验大幅提升;
涉及大量查询可以使用redis作为neo4j的一个缓存库,既能提高性能,也能避免neo4j的资源消耗;
2、分库存储,充分利用neo4j的图存储和查询特点,neo4j中只提供图的存储和查询功能,节点的属性信息保存在mongodb(或其他NoSql 数据库中—字段可以直接存储)进行关联查询,各取所长,充分利优势,优化性能;
3、使用neo4j企业版高可用、集群方案。
边栏推荐
- prompt learning 一个空格引发的血案
- Software testing skills, JMeter stress testing tutorial, transaction controller of logic controller (25)
- How can redis+aop customize annotations to achieve flow restriction
- JvxeTable子表记录加载完毕事件
- F1c100s self made development board debugging process
- Formal and actual parameters, value passing and address passing
- *Write a program to initialize a string object with a vector < char> container*/
- 备忘一下es6的export/import和类继承的用法
- &nbsp; Difference from spaces
- Possible problems in MySQL cross database operation with database name
猜你喜欢

公司电脑强制休眠的3种解决方案

LeetCode 3. Longest substring without duplicate characters

How to use vant to realize data paging and drop-down loading

2. 成功解决 BUG:Exception when publishing, ...[Failed to connect and initialize SSH connection...

Call collections Sort() method, compare two person objects (by age ratio first, and by name ratio for the same age), and pass lambda expression as a parameter.

Use compose to realize the effect of selecting movie seats by panning tickets

简单自定义MVC优化

What are outer chain and inner chain?

Raki's notes on reading paper: neighborhood matching network for entity alignment

Intel hex, Motorola S-Record format detailed analysis
随机推荐
The rigorous judgment of ID number is accurate to the last place in the team
Visual HTA form designer htamaker interface introduction and usage, Download | HTA VBS visual script writing
zabbix 触发器详解
Raki's notes on reading paper: discontinuous named entity recognition as maximum clique discovery
What is the metauniverse: where are we, where are we going
Simulate activity startup mode in compose
浅谈IDEA的优化和使用
怎样的外汇交易平台是有监管的,是安全的?
Shell counts all strings before the last occurrence of a string
JS 互相引用的问题
Welfare lottery | what are the highlights of open source enterprise monitoring zabbix6.0
Azure 开发者新闻快讯丨开发者6月大事记一览
怎么利用Redis实现点赞功能
prompt learning 一个空格引发的血案
NLP text summary: data set introduction and preprocessing [New York Times annotated corpus]
华为面试题: 分糖果
如果辨别我现在交易的外盘股指期货交易平台是否正规安全?
How do I enable assembly binding logging- How can I enable Assembly binding logging?
Add a custom button to jvxetable
2. successfully solved bug:exception when publishing [Failed to connect and initialize SSH connection...