ITeye博客

terry0501的博客

terry0501 · 共 192 篇文章

服务器CPU使用高排查(java)

javaweb 项目部署后发现很耗cpu,需要查出问题所在 写个测试程序,记相关步骤: 故意写个死循环 public class TestCpu { public static void main(String[] args) { while (true){ new Object(); } } } 终端: top 查看消耗cpu的进程 PID=2864 ps -mp 2864 -o THREAD,tid,time 查看线程TID=2866 把线程ID转为16进制 printf "%x\n" 2866 然后查看堆栈信息 jstack 2864 |grep b32 -A 30

2020-11-23 11:13 · Java基础 · linux 查看并发数 · 评论(0)

oracle 索引使用场景

Oracle 索引使用总结 前段时间公司在严查慢sql,总结一下索引的优缺点,使用场景,以及之前踩过的坑。 一、好处 1.提高查询速度 2.利用索引的唯一性来控制记录的唯一性 3.降低查询中分组和排序的时间 二、坏处 1.存储索引占用磁盘空间 2.执行数据修改操作(INSERT、UPDATE、DELETE)产生索引维护 索引是提高数据查询最有效的方法,也是最难全面掌握的技术,因为正确的索引可能使效率提高10000倍,而无效的索引可能是浪费了数据库空间,甚至大大降低查询性能。 3.存储索引的磁盘空间 4.执行数据修改操作(INSERT、UPDATE、DELETE)产生的索引维护 5.在数据处理…

2020-01-17 15:59 · sql function · 评论(0)

Spring定时器的时间表达式

字段 允许值 允许的特殊字符 秒 0-59 , - * / 分 0-59 , - * / 小时 0-23 , - * / 日期 1-31 , - * ? / L W C 月份 1-12 或者 JAN-DEC , - * / 星期 1-7 或者 SUN-SAT , - * ? / L C # 年(可选) 留空, 1970-2099 , - * / 表达式意义 "0 0 12 * * ?" 每天中午12点触发 "0 15 10 ? * *" 每天上午10:15触发 "0 15 10 * * ?" 每天上午10:15触发 "0 15 10 * * ? *" 每天上午10:15触发 "0 15 10…

2019-06-06 14:21 · 评论(0)

基于注解 spring aop 示例

import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; /** * * @author gaohailaing * *…

2019-03-13 17:19 · spring · 评论(0)

JVM 垃圾回收

摘要:一、根据程序的运行状况查看其活跃的数据量①、活跃的数据:1.应用程序运行于稳定状态时,老年代占用的java堆大小2.应用程序运行于稳定状态时,永久代占用的java堆大小其实就是FullGc后这2个数据的大小②、动手测试:1.测试代码:publicclassA{int[]storage=newint[102400];int[]extra=newint[200000];publicint[]execute(){try{Thread.sleep(10);}catch(Interru 一、根据程序的运行状况查看其活跃的数据量 ①、活跃的数据: 1.应用程序运行于稳定状态时,老年代占用的java…

2018-12-11 16:14 · 评论(0)

HTTP错误代码大全

Top 200 - OK 201 - Created 202 - Accepted 203 - Non-Authoritative Information (for DNS) 204 - No Content 205 - Reset Content 206 - Partial Content Redirection Codes 300 - Multiple Choices 301 - Moved Permanently 302 - Moved Temporarily 303 - See Other 304 - Not Modified 305 - Use Proxy 307 - Redire…

2018-12-06 16:44 · 评论(0)

mybatis 自动填充默认值

<!--mybatis-config--> <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="cacheEnabled" value="true" /> <setting name="lazyLoadingEnabled" value="true" />…

2018-12-04 18:23 · mybatis · 评论(0)

sql 根据身份证前两位更新省份

update ccms_acct_customer set province = case left(cid,2) when '11' then '北京市' when '12' then '天津市' when '13' then '河北' when '14' then '山西' when '15' then '内蒙' when '21' then '辽宁' when '22' then '吉林' when '23' then '黑龙江' when '31' then '上海' when '32' then '江苏' when '33' then '浙江' when '34' then '安徽…

2018-11-29 17:01 · 评论(0)

JVM 内存模型

我们知道,计算机CPU和内存的交互是最频繁的,内存是我们的高速缓存区,用户磁盘和CPU的交互,而CPU运转速度越来越快,磁盘远远跟不上CPU的读写速度,才设计了内存,用户缓冲用户IO等待导致CPU的等待成本,但是随着CPU的发展,内存的读写速度也远远跟不上CPU的读写速度,因此,为了解决这一纠纷,CPU厂商在每颗CPU上加入了高速缓存,用来缓解这种症状,因此,现在CPU同内存交互就变成了下面的样子。 同样,根据摩尔定律,我们知道单核 CPU的主频不可能无限制的增长,要想很多的提升新能,需要多个处理器协同工作, Intel总裁的贝瑞特单膝下跪事件标志着多核时代的到来。 基于高速缓存的存储交互很…

2018-11-07 21:55 · Java基础 · 评论(0)

kafka 命令发送接收消息

发送消息 ./kafka-console-consumer.sh --bootstrap-server 172.16.10.44:9092 --from-beginning --topic BILL_STATUS_CHANGE 接收消息 ./kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic BILL_STATUS_CHANGE

2018-11-07 16:55 · 评论(0)

linux 学习笔记

1.dos2unix 命令 应用场景,windows 下编辑过的shell脚本在linux 下不认识问题解决。

2018-10-31 16:51 · linux · 评论(0)

mysql之group_concat函数详解

函数语法: group_concat( 要连接的字段 ) 下面举例说明: select * from goods; +------+------+ | id| price| +------+------+ |1 | 10| |1 | 20| |1 | 20| |2 | 20| |3 | 200 | |3 | 500 | +------+------+ 6 rows in set (0.00 sec) 以id分组,把price字段的值在同一行打印出来,逗号分隔(默认) select id, group_concat(price) from goods group by id; +------+…

2018-10-31 16:35 · mysql · 评论(0)

文件下载

@RequestMapping(value = "/refundDepositDownload") public void download(HttpServletRequest request, HttpServletResponse response) { String key=request.getParameter("key"); RBinaryStream io=redissonClient.getBinaryStream(key); try { String fileName=new String("待退保证金列表".getBytes("gb2312"), "ISO8859-1"…

2018-08-03 11:29 · 评论(0)

读取项目静态文件

InputStream in = null; try { if (!isAlarming) { return; } in = this.getClass().getResourceAsStream("/static/email.html"); String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtil.defaultSimpleFormater)); String s = IOUtils.toString(in, "UTF-8"); String env = getEnvironment(); S…

2018-08-03 11:21 · common.io · commons · 评论(0)

maven mybatis 插件 自动生成持久层代码

2018-08-02 15:51 · mybatis · 评论(0)