CPU使用情况 第一行 内 容说 明 10:12:28系统当前时间 up 13:05系统的运行时间.本机己经运行 13 小时 05 分钟 3 users当前登录了三个用户 load average: 0.00,0.01,0.05系统在之前 1 分钟、5 分钟、15 分钟的平均负载。如果 CPU 是单核的,则这个数值超过 1 就是高负载:如果 CPU 是四核的,则这个数值超过 4 就是高负载 第二行 Tasks: 230 total系统中的进程总数 1 running正在运行的进程数 229 sleeping睡眠的进程数 0 stopped正在停止的进程数 0 zombie僵尸进程数。如果不是 0,则需要手工检查僵尸进程 第三行 内 容说 明 Cpu(s): 0.1 %us用户模式占用的 CPU 百分比 0.1%sy系统模式占用的 CPU 百分比 0.0%ni改变过优先级的用户进程占用的 CPU 百分比 99.7%ididle缩写,空闲 CPU 占用的 CPU 百分比 0.1%wa等待输入/输出的进程占用的 CPU 百分比 0.0%hi硬中断请求服务占用的....
什么是浏览器跨域 跨域:浏览器同源策略 1995年,同源政策由 Netscape 公司引入浏览器。目前,所有浏览器都实行这个政策。 最初,它的含义是指,A网页设置的 Cookie,B网页不能打开,除非这两个网页"同源"。所谓"同源"指的是"三个相同" 协议相同 http https 域名相同 www.xdclass.net 端口相同 80 81 一句话:浏览器从一个域名的网页去请求另一个域名的资源时,域名、端口、协议任一不同,都是跨域 浏览器控制台跨域提示: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. 解决方法 1)JSONP 2)Http响应头配置允许跨域 nginx层配置 https://www.cnblogs.com/hawk-whu/p/6725699.html 3)程序代码中处理 SpringBoot 通过拦截器配置 //表示接受任意域名的请求,也可以指定域名 ....
分布式缓存和本地缓存知识 什么是缓存 程序经常要调用的对象存在内存中,方便其使用时可以快速调用,不必去数据库或者其他持久化设备中查询,主要就是提高性能 DNS缓存、前端缓存、代理服务器缓存Nginx、应用程序缓存(本地缓存、分布式缓存)、数据库缓存 分布式缓存 与应用分离的缓存组件或服务,与本地应用隔离一个独立的应用,多个应用可直接的共享缓存 常见的分布式缓存 Redis、Memcached等 本地缓存 和业务程序一起的缓存,例如myabtis的一级或者二级缓存,本地缓存自然是最快的,但是不能在多个节点共享 常见的本地缓存:ssm基础课程myabtis 一级缓存、mybatis二级缓存;框架本身的缓存; redis本地单机服务;ehchche;guava cache、Caffeine等 选择本地缓存和分布式缓存 和业务数据结合去选择 高并发项目里面一般都是有本地缓存和分布式缓存共同存在的 Guava Cache github地址:https://github.com/google/guava/wiki/CachesExplained 全内存的本地缓....
统一输出协议,驼峰转下划线 格式化日期 package net.xdclass.online_xdclass.model.entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Date; import java.util.List; /** * * `id` int(11) unsigned NOT NULL AUTO_INCREMENT, * `title` varchar(524) DEFAULT NULL COMMENT '视频标题', * `summary` varchar(1026) DEFAULT NULL COMMENT '概述', * `cover_img` varchar(524) DEFAULT NULL COMMENT '封面图', * `price` int(11) DEFAULT NULL COMMENT '价格,分', * `create_time` ....
表设计 play_record CREATE TABLE `play_record` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, `video_id` int(11) DEFAULT NULL, `current_num` int(11) DEFAULT NULL COMMENT '当前播放第几集', `episode_id` int(11) DEFAULT NULL COMMENT '当前播放第几集视频id', `create_time` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; Model package net.xdclass.online_xdclass.model.entity; import java.util.Date; /** * 小滴课堂 播放记录 * * `id` int(11) unsign....
RequestEntity package net.xdclass.online_xdclass.model.request; import com.fasterxml.jackson.annotation.JsonProperty; public class VideoOrderRequest { @JsonProperty("video_id") private int videoId; public int getVideoId() { return videoId; } public void setVideoId(int videoId) { this.videoId = videoId; } } Controller package net.xdclass.online_xdclass.controller; import net.xdclass.online_xdclass.model.request.VideoOrderRequest; import net.xdclass.online_xdclass.service.VideoOrderService; impor....
自定义拦截器 package net.xdclass.online_xdclass.interceptor; import com.fasterxml.jackson.databind.ObjectMapper; import io.jsonwebtoken.Claims; import net.xdclass.online_xdclass.utils.JWTUtils; import net.xdclass.online_xdclass.utils.JsonData; import org.apache.commons.lang3.StringUtils; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.....