美文网首页
无标题文章

无标题文章

作者: 王宇_c8b6 | 来源:发表于2017-09-30 14:05 被阅读0次

    缓存优化:
    优化缓存数据结构,减少属性,复用共同引用,String.Intern()
    优化存储时间,自动清理机制
    删除不必要的缓存

    OOM,GC频繁
    1、分批处理,及时释放,避免由于新生代空间不够对象直接进入老年代,触发Full GC

    查询效率提升:
    1、读写锁

    CPU优化
    1、减少rpc请求次数,改为批量调用
    2、List,hash初始化大小,避免resize

    数据库优化:
    批量入库
    使用强制索引

    JVM参数调优
    -XX:+ExplicitGCInvokesConcurrent
    如今,被广泛接受的最佳实践是避免显式地调用GC(所谓的“系统GC”),即在应用程序中调用system.gc()。然而,这个建议是不管使用的GC算法的,值得一提的是,当使用CMS收集器时,系统GC将是一件很不幸的事,因为它默认会触发一次Full GC。幸运的是,有一种方式可以改变默认设置。标志-XX:+ExplicitGCInvokesConcurrent命令JVM无论什么时候调用系统GC,都执行CMS GC,而不是Full GC。第二个标志-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses保证当有系统GC调用时,永久代也被包括进CMS垃圾回收的范围内。因此,通过使用这些标志,我们可以防止出现意料之外的”stop-the-world”的系统GC。

    i2kuser 21868 21478 30 14:16 pts/5 00:27:22 /opt/huawei/I2000/run/jre/bin/java -Dprocname=I2000 -verbose:class -Xdebug -Xrunjdwp:transport=dt_socket,address=32041,server=y,suspend=n -Xms16g -Xmx16g -XX:MetaspaceSize=800m -XX:MaxMetaspaceSize=800m -XX:ReservedCodeCacheSize=512m -Xmn6g -XX:SurvivorRatio=6 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses -XX:+UseFastAccessorMethods -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 -XX:ParallelGCThreads=6 -Djava.security.egd=file:/dev/./urandom -XX:+HeapDumpOnOutOfMemoryError -Djdk.xml.entityExpansionLimit=0 -Djdk.xml.entityExpansionLimit=0 -XX:CICompilerCount=2 -XX:-OmitStackTraceInFastThrow -Xloggc:/opt/huawei/I2000/run/var/iemp/log/gc.iemp.log -verbose:gc -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=5M

    相关文章

      网友评论

          本文标题:无标题文章

          本文链接:https://www.haomeiwen.com/subject/ibecextx.html