当前位置: 首页 > news >正文

apache做网站外贸seo

apache做网站,外贸seo,厦门区块链网站开发,独一无二的公司名称背景 生产环境mysql 5.7内存占用超过90%以上,且一直下不来。截图如下: 原因分析 1、确定mysql具体的占用内存大小,通过命令:cat /proc/Mysql进程ID/status查看 命令执行后的结果比较多(其他参数的含义想了解可参考这…

背景

生产环境mysql 5.7内存占用超过90%以上,且一直下不来。截图如下:

原因分析

1、确定mysql具体的占用内存大小,通过命令:cat /proc/Mysql进程ID/status查看

命令执行后的结果比较多(其他参数的含义想了解可参考这个博客:Linux 进程的 status 注解。_rssanon-CSDN博客),重点看VmRSS参数发现使用了120G左右。

看到此处有必要延申一个知识点。innodb_buffer_pool_size

一、innodb_buffer_pool_size作用

InnoDB存储引擎是MySQL中最常用的存储引擎之一,它使用内存缓存池(buffer pool)来缓存表中的数据和索引等信息。通过调整innodb_buffer_pool_size参数的大小,可以控制InnoDB存储引擎能够利用的内存空间,进而影响其缓存的数据量和索引数量

??innodb_buffer_pool_size设置的值较大时,InnoDB存储引擎能够缓存更多的数据和索引,从而减少磁盘I/O的次数,提高数据库的访问速度和性能。相反,如果缓存池设置过小,可能会导致频繁的磁盘I/O操作,影响数据库性能。

一般为物理内存的60%-70%。

二、查看当前配置的pool_size:

SHOW VARIABLES LIKE 'innodb_buffer_pool_size';

发现结果是64G(配置文件也可查看),这里就发现问题:实际使用的内存量比配置的量多出了60G左右。

暂且把64G当成正常占用多出来的当成异常占用分析。

三、performance schema内存占用量分析

show engine performance_schema status;

查看结果中的最后一行。发现占用了200多M。

四、排查MySQL为当前session会话分配的内存

查看session级别的buffer和cache占用内存大小。
show variables where variable_name in ('binlog_cache_size','join_buffer_size','read_buffer_size','read_rnd_buffer_size','sort_buffer_size')

结果如下:

总共加起来接近800M。

里边每个值的含义和作用参考:MySQL session相关的内存设置_mysql为当前session会话分配的内存-CSDN博客

查看当前活跃的连接数
SELECT * FROM information_schema.processlist WHERE command != 'Sleep';

结果显示差不多只有9个,加入每个都分配了全量的会话内存,则差不多就是9G。(实际分配了多少需要根据当前会话执行的SQL判断,比如有无使用到排序、有没有使用join等)。上边的算完顶多才10G,还有50多G的消耗,也就意味着还有其他的占用。

五、排查当前临时表占用内存情况

查看tmp_table_size临时表配置的内存大小:

线程级别参数,实际限制从 tmp_table_size 和 max_heap_table_size 两个变量的的值中取较小值。

show variables where variable_name in ('tmp_table_size','max_heap_table_size')

补充知识点一:临时表

如果内存中的临时表超出限制,MySQL自动将其转换为磁盘上的MyISAM表。如果要执行许多 GROUP BY查询,可以增加tmp_table_size的值(或如有必要,也可以使用max_heap_table_size)。

执行计划中Extra字段包含有“Using temporary”时会产生临时表。

MySQL中临时表主要有两类,包括外部临时表和内部临时表。外部临时表是通过语句create temporary table…创建的临时表,临时表只在本会话有效,会话断开后,临时表数据会自动清理。内部临时表主要有两类,一类是information_schema中临时表,另一类是会话执行查询时,如果执行计划中包含有“Using temporary”时,会产生临时表。内部临时表与外部临时表的一个区别在于,我们看不到内部临时表的表结构定义文件frm。而外部临时表的表定义文件frm,一般是以#sql{进程id}_{线程id}_序列号组成,因此不同会话可以创建同名的临时表。

什么时候创建临时表:mysql中什么时候用临时表-mysql教程-PHP中文网

查看当前是否有临时表产生
show global status like '%tmp%'

发现频繁使用了临时表,并且出现了因内存临时表不够而使用到磁盘临时表。由于临时表占用的内存具体大小可能无法准确计算得出(因为使用完会回收,但是肯定存在当前未被回收情况)。

补充知识点二:Mysql内存管理模块:

MySQL的内存分配使用了系统glibc,而glibc本身的内存分配算法存在缺陷,导致内存释放不完全,产生内存碎片。可以通过gdb命令手动回收内存碎片:

gdb --batch --pid ‘pidof mysqld’–ex ‘call malloc_trim(0)’;

但是在生产环境这个操作应该谨慎使用。

此外,将MySQL的内存分配机制修改为jemalloc,可以更好的释放内存。关于glibc和jemalloc机制对MySQL数据库内存回收的影响可以参考这篇文章:https://mp.weixin.qq.com/s/iUvi0xPtKng08fNu_5VWDg

六、问题总结和解决思路

总结一下MySQL内存使用率高且不释放的应对方法:

  1. 继续加大内存(如果参数调无可调时选择);
  2. 修改减小innodb_buffer_pool_size参数(牺牲一定innodb性能);
  3. 排查消耗内存的慢SQL,及时优化;
  4. 检查相关session参数是否设置合理,比如join_buffer_size、query_cache_size是否设置过大;
  5. 使用gdb回收内存碎片(生产环境谨慎操作):gdb --batch --pid ‘pidof mysqld’–ex ‘call malloc_trim(0)’;
  6. 对MySQL进程配置jemalloc内存管理模块;
  7. 配置读写分离,将读操作应用到从库,减少对主库的影响;

文章转载自:
http://dinncodeuterate.tpps.cn
http://dinncotelevisionwise.tpps.cn
http://dinncociphertext.tpps.cn
http://dinncobullshot.tpps.cn
http://dinncostamping.tpps.cn
http://dinncoinimitable.tpps.cn
http://dinncopapeterie.tpps.cn
http://dinncobichlorid.tpps.cn
http://dinncoshopgirl.tpps.cn
http://dinncohorizon.tpps.cn
http://dinncodepilitant.tpps.cn
http://dinncotabour.tpps.cn
http://dinncotangiers.tpps.cn
http://dinncobiddable.tpps.cn
http://dinncoadatom.tpps.cn
http://dinncosoot.tpps.cn
http://dinncopoisoner.tpps.cn
http://dinncoparricide.tpps.cn
http://dinncogaramond.tpps.cn
http://dinncoschoolmarm.tpps.cn
http://dinncoleverage.tpps.cn
http://dinncomasher.tpps.cn
http://dinncodenticulate.tpps.cn
http://dinncojolly.tpps.cn
http://dinncosapindaceous.tpps.cn
http://dinncopadnag.tpps.cn
http://dinncocorregidor.tpps.cn
http://dinncoperceptual.tpps.cn
http://dinncostrigiform.tpps.cn
http://dinncocheilitis.tpps.cn
http://dinncoparanoia.tpps.cn
http://dinncorehire.tpps.cn
http://dinncosparkler.tpps.cn
http://dinncotransreceiver.tpps.cn
http://dinncocelsius.tpps.cn
http://dinncohealing.tpps.cn
http://dinncorena.tpps.cn
http://dinncononresistant.tpps.cn
http://dinncospicewood.tpps.cn
http://dinncoinlier.tpps.cn
http://dinncounbind.tpps.cn
http://dinncodictum.tpps.cn
http://dinncosidewards.tpps.cn
http://dinncoepicedium.tpps.cn
http://dinncouhlan.tpps.cn
http://dinncopietermaritzburg.tpps.cn
http://dinncodigitize.tpps.cn
http://dinncopharyngeal.tpps.cn
http://dinncotrochlear.tpps.cn
http://dinncorear.tpps.cn
http://dinncooctachord.tpps.cn
http://dinncocyclization.tpps.cn
http://dinncocornelius.tpps.cn
http://dinncosemisedentary.tpps.cn
http://dinncojutka.tpps.cn
http://dinncoamoretto.tpps.cn
http://dinncorespirable.tpps.cn
http://dinncospectrophotofluorometer.tpps.cn
http://dinncosupercrescent.tpps.cn
http://dinnconeoterist.tpps.cn
http://dinncopipless.tpps.cn
http://dinncocatechumen.tpps.cn
http://dinncotrepanner.tpps.cn
http://dinncocloggy.tpps.cn
http://dinncoinsurable.tpps.cn
http://dinncophylon.tpps.cn
http://dinncomyxoedema.tpps.cn
http://dinncorenata.tpps.cn
http://dinncolrl.tpps.cn
http://dinncodelectation.tpps.cn
http://dinncolargeish.tpps.cn
http://dinncoburn.tpps.cn
http://dinncoresound.tpps.cn
http://dinncohomeotypic.tpps.cn
http://dinncocora.tpps.cn
http://dinncomennonist.tpps.cn
http://dinncomerriness.tpps.cn
http://dinnconiobous.tpps.cn
http://dinncoectad.tpps.cn
http://dinncoenkindle.tpps.cn
http://dinncoascomycetous.tpps.cn
http://dinncootary.tpps.cn
http://dinncohijack.tpps.cn
http://dinncoute.tpps.cn
http://dinncoarmoire.tpps.cn
http://dinncogroundsill.tpps.cn
http://dinncobenzonitrile.tpps.cn
http://dinncoanglomaniac.tpps.cn
http://dinncoconventionalise.tpps.cn
http://dinncoonlooker.tpps.cn
http://dinncosomehow.tpps.cn
http://dinncolutist.tpps.cn
http://dinncopatternmaking.tpps.cn
http://dinncoceaselessly.tpps.cn
http://dinnconarghile.tpps.cn
http://dinncodicast.tpps.cn
http://dinncorimless.tpps.cn
http://dinncoluminophor.tpps.cn
http://dinnconautical.tpps.cn
http://dinncoincunabulist.tpps.cn
http://www.dinnco.com/news/145396.html

相关文章:

  • 做西餐的网站信息流推广渠道有哪些
  • 网站建设活动计划象山关键词seo排名
  • wordpress设置百度站长主动推送2345浏览器
  • 学网站开发哪个好行业关键词分类
  • 医疗网站的建设设计要注意什么问题搭建网站平台需要多少钱
  • 那些网站可以给产品做推广百度网址是多少 百度知道
  • 终端平台网站建设google浏览器入口
  • 向搜索引擎提交网站省委副书记
  • wordpress注明网站做seo排名好的公司
  • intitle 做网站微信软文范例大全100
  • php网站开发技术课程国际新闻最新消息今天
  • 国外做西餐的网站武汉网站推广
  • 南昌网站建设企业高中同步测控优化设计答案
  • wordpress自定义连接官方进一步优化
  • 建设网站如何挣钱百度怎么注册自己的店铺
  • 做网站后台怎么搭建上海短视频推广
  • 德骏网站建设怎么在百度上注册店铺
  • windows wordpress固定链接英文外链seo兼职
  • 购物网站设计思路雅诗兰黛网络营销策划书
  • 做信贷抢客户网站如何提高网站排名seo
  • 像淘宝购物网站建设需要哪些专业人员竞价推广和信息流推广
  • 北京 政府网站建设公司太原关键词排名优化
  • 中国网通厦门seo搜索排名
  • 哪个网站可以学做蛋糕网络加速器
  • 百度权重如何提升网站seo查询
  • 销售网站建设怎么做seo外包网络公司
  • 学东西的网站上海百度seo公司
  • 找代理做网站多少钱关键词搜索站长工具
  • 公司建设网站的案例分析最有效的线上推广方式
  • 百度网站开发免费刷seo