本文的目的是介绍IncreasememoryusageforInnoDBMySQLdatabasetoimprovep_MySQL的详细情况,我们将通过专业的研究、有关数据的分析等多种方式,同时也不会
本文的目的是介绍Increase memory usage for InnoDB MySQL database to improve p_MySQL的详细情况,我们将通过专业的研究、有关数据的分析等多种方式,同时也不会遗漏关于03-limit-memory-usage-es控制聚合内存使用-elasticsearch权威指南翻译、68.You are managing an Oracle Database 11g database. You want to ensure the recovery of the database、73.You are managing an Oracle Database 11g database. You configured the database to run in ARCHIVELO、78.You are managing an Oracle Database 11g database. The database is open, and you plan to perform R的知识。
本文目录一览:- Increase memory usage for InnoDB MySQL database to improve p_MySQL
- 03-limit-memory-usage-es控制聚合内存使用-elasticsearch权威指南翻译
- 68.You are managing an Oracle Database 11g database. You want to ensure the recovery of the database
- 73.You are managing an Oracle Database 11g database. You configured the database to run in ARCHIVELO
- 78.You are managing an Oracle Database 11g database. The database is open, and you plan to perform R
Increase memory usage for InnoDB MySQL database to improve p_MySQL
if your mysql database tables still run on the myisam engine (formerly the default), you may want to consider switching to the innodb engine instead, for better reliability and scalability. to update a table from myisam to innodb you can run this sql:
ALTER TABLE table_name ENGINE = InnoDB;
Once you’ve switched all your tables to InnoDB, you can adjust some memory usage settings.
Update MySQL memory usage settings for InnoDB
Firstly, check the current settings for innerdb_buffer_pool_size . You can view these settings by running the following SQL (you can run this in phpMyAdmin):
SHOW VARIABLES;
Look for innerdb_buffer_pool_size . You’ll see it’s been assigned a particular number of bytes. This allocated cache stores table and index data, and keeps queries and query results in memory for faster lookup. So the more memory you can afford to dedicate to it the better – MySQL recommends to use 80% of the available memory. You can read about it here .
I had 2GB of server memory to play with, so I chose a moderate 1GB to allocate to the innerdb_buffer_pool_size . To add this setting, we’ll create and load our own custom MySQL cnf file, which will house some extra settings.
On Linux Ubuntu , add a new cnf file here:
sudo nano /etc/mysql/conf.d/innodb.cnf
The file name must end in .cnf , but call it whatever you like, so long as it’s not clashing with another file name.
Inside of this file, we add our new memory allocation:
[mysqld]innodb_buffer_pool_size = 1024Mkey_buffer_size = 8M
I’ve also added a new key_buffer_size value of 8MB. If you’ve deprecated your use of the MyISAM engine, it’s recommended to reduce this memory allocation. Previously I had 16M for key_buffer_size , so I decided to half it.
Finish off by restarting MySQL so that the changes can be applied:
sudo service mysql restart
If you check the MySQL variables once more:
SHOW VARIABLES;
You’ll hopefully now have some new and importantly increased memory values for innodb_buffer_pool_size and key_buffer_size
You’ve successfully optimised your MySQL database a bit more!
03-limit-memory-usage-es控制聚合内存使用-elasticsearch权威指南翻译
为了让类似agg这种需要获取field value的操作是需要返回请求迅速的,这是为什么会把fielddata加载到内存中的原因,但是大量的fielddata会导致内存回收慢,甚至内存异常。
也许你惊奇的会发现es不仅把匹配你查询的文档的值放到了fielddata中,竟然把所有文档的值放在了内存中,甚至包括type。
逻辑是,你查询前面的可能会查询后面的,一次把所有数据加载进来并保存到内存中会很方便的和快速的,否则每个请求都去倒排索引中查一次。
JVM HEAP是有限制的,应该明智使用。有各种各样的机制来限制fielddata的使用,这些限制是非常重要的,因为滥用HEAP会导致系统不稳定甚至不可用。
选择一个HEAP SIZE
有两种规则来设置这个值,通过$ES_HEAP_SIZE变量
(1)不能超过系统内存的50%
(2)不能超过32GB,在32GB内,JVM会自动压缩,这样可以节约很多的内存,8bytes压缩到4 bytes,超过32,意味着你可用内存会越来越小,因为原来压缩的都变大了。
field data
indices.fielddata.cache.size 这个值控制了多少内存用于field data,当你进行查询的时候,需要新的field value,系统将会把数据加载dao内存而且尝试把数据加载到fielddata中,如果这些值超过了范围,其他的值将被踢出去来让出空间来。
默认es没有限制这个值,也就是说es从不会剔除数据去。
这个默认设置系统是有意这样做的,fielddata不是短暂数据,这些数据存在内存中能很快执行,而且建立这些数据是非常不容易的,如果每次请求再去加载这些数据表现会很差。
通过设置一个限定值将会根据值剔除数据,我们接下来会看到如何设置这个值。
首先,这个值是一个安全值,但不是内存不足的解决方案。
如果你没有足够的内存让这些数据常驻内存,es将会经常的从硬盘加载数据然后剔除旧的数据给新数据让出空间,evict过程会导致大量的IO操作,并且生成大量的内存垃圾需要去回收。
想象一下你正在index log数据,每天使用新的index,突然有天你想看前两天数据,如果是默认设置,旧数据酒会不断给内存中加入,直到circuit breaker。但这个时候系统也不能再加载新的数据了,因为都让fielddata占用了。
为了防止这件事情,需要在yml文件中进行设置:
indices.fielddata.cache.size: 40%
也可以设置一个具体的值:5gb
通过这个设置,上述那种情况中的新的fielddata会剔除出去,旧的会进来。
监控fielddata
对index监控
GET /_stats/fielddata?fields=*
对每个nodes监控
GET /_nodes/stats/indices/fielddata?fields=*
对每个index每个node监控
GET /_nodes/stats/indices/fielddata?level=indices&fields=*
circuit breaker(也许带入的fielddata 超过了整个的size)
细心的读者会发现一个问题:fielddata size是在数据加载进内存才核对的,如果一个query加入的fielddata比设置值大怎么办?结果是内存异常。
es有个circuit breaker就是用于处理这个问题的,这个模块会估计一个query进来带入的fielddata需要的内存,然后检察是否会超过fielddata的size
如果获取的值超过这个值,该query会在数据加载进来前被停止,也就是说不会看到内存异常.
默认这些值进行了设置:
indices.breaker.fielddata.limit 默认是HEAP的60%
indices.breaker.request.limit 默认是HEAP 40%
indices.breaker.total.limit 两者合起来不能超过HEAP 70%默认
可以动态的设置
PUT /_cluster/settings
{
"persistent" : {
"indices.breaker.fielddata.limit" : "40%"
}
}
circuit breaker limit 设置必须比indices.fielddata.cache.size大,如果小了,就不存在数据evict了,达到limit就阻止query了,cache第一道防线,limit最后一道防线。
最后这些值是保守值,用户还得好好思考啊
68.You are managing an Oracle Database 11g database. You want to ensure the recovery of the database
68.You are managing an Oracle Database 11g database. You want to ensure the recovery of the database to the point of failure. Which configuration will you do to accomplish the task? A.Multiplex all database files. B.Configure the Flash Recovery Area. C.Configure the database instance for ARCHIVELOG mode. D.Configure the FAST_START_MTTR_TARGET initialization parameter. 答案:C 解析:这个说是恢复到错误发生的时间点,这个相当于不完全恢复,不完全恢复的先觉条件是@R_301_6250@处于归档模式 当@R_301_6250@设置为归档模式之后对@R_301_6250@意味着 1.当@R_301_6250@(磁盘或系统文件问题所导致的)崩溃之后,所有提交的数据都能恢复 2.可以对@R_301_6250@进行联机备份,而且在联机备份期间可以继续进行其他的操作 3.当某一非系统表空间脱机时,@R_301_6250@的其他部分继续正常工作 4.可以进行如下的不完全恢复 a.恢复到某一特定的时间点 b.恢复到某一特定的scn号 c.恢复到某一特定的归档文件的结尾73.You are managing an Oracle Database 11g database. You configured the database to run in ARCHIVELO
73.You are managing an Oracle Database 11g database. You configured the database to run in ARCHIVELOG mode. Which two statements are true in this scenario? (Choose two.) A.You must shut down the database instance to perform the backups. B.You must configure the Flash Recovery Area (FRA) for the database. C.You can perform complete database backups without closing the database. D.All the prevIoUs closed database backups including control files become invalid after you configure the database to ARCHIVELOG mode. 答案:CD 解析: A.归档模式后,备份不需要关闭数据库,属于热备,因此A是错误的,当然也可以关闭进行一致性备份,但不是必须关闭数据库 B.fra默认路径为$ORACLE_BASE/fast_recovery_area,不需要费的配置,因此B也是错误的 C.正确,备份的时候,是备份了一个点,然后通过归档日志执行前滚实现了完全备份 D.正确,当打开归档后 sql> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 77 Next log sequence to archive 77 Current log sequence 79 这里的Current log sequence将会被重置为1,也就是之前的都变成了invalid78.You are managing an Oracle Database 11g database. The database is open, and you plan to perform R
78.You are managing an Oracle Database 11g database. The database is open,and you plan to perform Recovery Manager (RMAN) backups. Which three statements are true about these backups? (Choose three.) A.The backups would be consistent. B.The backups would be inconsistent. C.The backups would be possible only if the database is running in ARCHIVELOG mode. D.The backups would be possible only if the database is running in NOARCHIVELOG mode. E.The backups need to be restored and the database has to be recovered in case of a media failure. 答案:BCE 解析:只要是open状态进行备份的都是不一致备份排除A rman在非归档模式下执行进行脱机备份也就是冷备,因此排除D E说的是介质有问题了,备份必须restore然后recovered,这里说一下restore和recover的区别 restore:从备份位置还原一个或者多个数据库文件 recover:应用归档和联机重做日志文件,将整个数据库或单独数据库文件前滚到指定的scn 这就是归档文件的作用,当执行备份的时候,只是备份到一个点的数据,但是在备份之后这段时间执行的数据,就需要 通过recover利用归档日志,来进行前滚实现,因此需要这两步今天关于Increase memory usage for InnoDB MySQL database to improve p_MySQL的讲解已经结束,谢谢您的阅读,如果想了解更多关于03-limit-memory-usage-es控制聚合内存使用-elasticsearch权威指南翻译、68.You are managing an Oracle Database 11g database. You want to ensure the recovery of the database、73.You are managing an Oracle Database 11g database. You configured the database to run in ARCHIVELO、78.You are managing an Oracle Database 11g database. The database is open, and you plan to perform R的相关知识,请在本站搜索。
本文标签: