diff --git a/404.html b/404.html new file mode 100644 index 00000000..c3c2f7b8 --- /dev/null +++ b/404.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + +
跳至主要內容

404

页面不存在

这 是 四 零 四 !

+ + + diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..2f77233b --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +wenzhihuai.com \ No newline at end of file diff --git a/ads.txt b/ads.txt new file mode 100644 index 00000000..be5a5540 --- /dev/null +++ b/ads.txt @@ -0,0 +1 @@ +google.com, pub-9037099208128116, DIRECT, f08c47fec0942fa0 \ No newline at end of file diff --git a/article/index.html b/article/index.html new file mode 100644 index 00000000..157b39d2 --- /dev/null +++ b/article/index.html @@ -0,0 +1,87 @@ + + + + + + + + + + 文章 | 个人博客 + + + + + +
跳至主要內容
在 Spring 6 中使用虚拟线程

在 Spring 6 中使用虚拟线程

+

一、简介

+

在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。

+

虚拟线程是Java 19 的预览功能,这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。Spring 6 版本最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。


Zephery大约 5 分钟
微信公众号-chatgpt智能客服搭建

微信公众号-chatgpt智能客服搭建

+

想体验的可以去微信上搜索【旅行的树】公众号。

+

一、ChatGPT注册

+

1.1 短信手机号申请

+

openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。

+

国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。

+

国外手机号,没有的话也可以去https://sms-activate.org,费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。


Zephery大约 10 分钟
Tesla api

Tesla api

+

一、特斯拉应用申请

+

1.1 创建 Tesla 账户

+

如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。

+

正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator.

+ + +

注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。

+

1.2 提交访问请求

+

点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。


Zephery大约 4 分钟
【elasticsearch】搜索过程详解

【elasticsearch】搜索过程详解

+

本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。

+

SearchType

+

QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。
+DFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。


Zephery大约 9 分钟
1.历史与架构

1.历史与架构

+

各位大佬瞄一眼我的个人网站呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址https://github.com/Zephery/newblog
+大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。


Zephery大约 7 分钟
+ + + diff --git "a/assets/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html-l2oUbETx.js" "b/assets/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html-l2oUbETx.js" new file mode 100644 index 00000000..126ee6ea --- /dev/null +++ "b/assets/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html-l2oUbETx.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-37ac02fe","path":"/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html","title":"1.历史与架构","lang":"zh-CN","frontmatter":{"description":"1.历史与架构 各位大佬瞄一眼我的个人网站呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址https://github.com/Zephery/newblog 。 大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"1.历史与架构"}],["meta",{"property":"og:description","content":"1.历史与架构 各位大佬瞄一眼我的个人网站呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址https://github.com/Zephery/newblog 。 大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"1.历史与架构\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"1.建站故事与网站架构","slug":"_1-建站故事与网站架构","link":"#_1-建站故事与网站架构","children":[{"level":3,"title":"1.1建站过程","slug":"_1-1建站过程","link":"#_1-1建站过程","children":[]},{"level":3,"title":"1.2 网站整体技术架构","slug":"_1-2-网站整体技术架构","link":"#_1-2-网站整体技术架构","children":[]},{"level":3,"title":"1.3 日志系统","slug":"_1-3-日志系统","link":"#_1-3-日志系统","children":[]},{"level":3,"title":"1.4 【有点意思】自然语言处理","slug":"_1-4-【有点意思】自然语言处理","link":"#_1-4-【有点意思】自然语言处理","children":[]}]},{"level":2,"title":"总结","slug":"总结","link":"#总结","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":6.78,"words":2033},"filePathRelative":"personalWebsite/1.历史与架构.md","localizedDate":"2024年1月25日","excerpt":"

1.历史与架构

\\n

各位大佬瞄一眼我的个人网站呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址https://github.com/Zephery/newblog
\\n大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。

","autoDesc":true}');export{e as data}; diff --git "a/assets/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html-piLOZJaO.js" "b/assets/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html-piLOZJaO.js" new file mode 100644 index 00000000..efd2a9fa --- /dev/null +++ "b/assets/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html-piLOZJaO.js" @@ -0,0 +1 @@ +import{_ as l}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as i,c as a,a as e,d as t,b as n,e as s}from"./app-hbwtiwmf.js";const h={},c=e("h1",{id:"_1-历史与架构",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-历史与架构","aria-hidden":"true"},"#"),t(" 1.历史与架构")],-1),_={href:"http://www.wenzhihuai.com/",target:"_blank",rel:"noopener noreferrer"},d={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},p=e("br",null,null,-1),u=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/home.png?imageView2/2/w/600",alt:"",tabindex:"0"}),e("figcaption")],-1),g={href:"http://www.wenzhihuai.com/weibonlp.html",target:"_blank",rel:"noopener noreferrer"},b=e("br",null,null,-1),f=e("br",null,null,-1),m={href:"https://github.com/Zephery/newblog/blob/master/doc/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.md",target:"_blank",rel:"noopener noreferrer"},w=e("br",null,null,-1),E={href:"https://github.com/Zephery/newblog/blob/master/doc/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.md",target:"_blank",rel:"noopener noreferrer"},B=e("br",null,null,-1),x={href:"https://github.com/Zephery/newblog/blob/master/doc/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.md",target:"_blank",rel:"noopener noreferrer"},k=e("br",null,null,-1),v={href:"https://github.com/Zephery/baidutongji/blob/master/README.md",target:"_blank",rel:"noopener noreferrer"},A=e("br",null,null,-1),y={href:"https://github.com/Zephery/newblog/blob/master/doc/6.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.md",target:"_blank",rel:"noopener noreferrer"},V=e("br",null,null,-1),z=e("li",null,[t("[数据库]"),e("br")],-1),C=e("li",null,[t("使用机器学习对微博进行分析"),e("br")],-1),P=e("li",null,[t("网站性能优化"),e("br")],-1),S=e("li",null,[t("SEO优化"),e("br")],-1),j=e("h2",{id:"_1-建站故事与网站架构",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-建站故事与网站架构","aria-hidden":"true"},"#"),t(" 1.建站故事与网站架构")],-1),I=e("h3",{id:"_1-1建站过程",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-1建站过程","aria-hidden":"true"},"#"),t(" 1.1建站过程")],-1),H={href:"http://www.yangqq.com/",target:"_blank",rel:"noopener noreferrer"},M=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/joihfiohewifoheifahiauhvuia.png?imageView2/2/w/500",alt:"",tabindex:"0"}),e("figcaption")],-1),Z=e("p",null,"第二版的界面确实是这样的,只是把图片的切换变成了wowslider,也是简单的用bootstrap和pagehelper做了下分页,现在的最终版保留了它的header,然后评论框使用了多说(超级怀念多说)。后端也由原来的ssh变成了ssm,之后加上了lucene来对文章进行索引。之后,随着多说要关闭了,突然之间有很多div都不适应了(我写死了的。。。),再一次,没法看,不想看,一怒之下再次推翻重做,变成了现在这个版本。",-1),F={href:"https://tale.biezhi.me",target:"_blank",rel:"noopener noreferrer"},q={href:"https://yusi123.com",target:"_blank",rel:"noopener noreferrer"},G=e("br",null,null,-1),J=e("br",null,null,-1),R=e("h3",{id:"_1-2-网站整体技术架构",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-2-网站整体技术架构","aria-hidden":"true"},"#"),t(" 1.2 网站整体技术架构")],-1),D=e("p",null,"最终版的技术架构图如下:",-1),L=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/awfawefwefwef.png",alt:"",tabindex:"0"}),e("figcaption")],-1),N={href:"http://jinnianshilongnian.iteye.com/blog/1594806",target:"_blank",rel:"noopener noreferrer"},T=s('

运行流程分析

  1. 浏览器发送http请求。/blogdetail.html?blogid=1。
  2. tomcat容器初始化,顺序为context-param>listener>filter>servlet,此时,spring中的bean还没有被注入的,不建议在此处加载bean,网站声明了两个类(IPFilter和CacheControlFilter),IPFilter用来拦截IP,CacheControlFilter用来缓存。
  3. 初始化Spring。
  4. DispatcherServlet——>HandlerMapping进行请求到处理的映射,HandlerMapping将“/blogdetail”路径直接映射到名字为“/blogdetail”的Bean进行处理,即BlogController。
  5. 自定义拦截器,其中BaseIntercepter实现了HandleInterceptor的接口,用来记录每次访问的链接以及后台响应的时间。
  6. DispatcherServlet——> SimpleControllerHandlerAdapter,SimpleControllerHandlerAdapter将HandlerExecutionChain中的处理器适配为BlogController。
  7. BlogController执行查询,取得结果集返回数据。
  8. blogdetail(ModelAndView的逻辑视图名)——>InternalResourceViewResolver, InternalResourceViewResolver使用JstlView,具体视图页面在/blogdetail.jsp。
  9. JstlView(/blogdetail.jsp)——>渲染,将在处理器传入的模型数据(blog=Blog!)在视图中展示出来。
  10. 返回响应。

1.3 日志系统

日志系统架构如下:

',6),U={href:"http://www.wenzhihuai.com/log.html",target:"_blank",rel:"noopener noreferrer"},K=e("br",null,null,-1),Q=e("br",null,null,-1),X=e("h3",{id:"_1-4-【有点意思】自然语言处理",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-4-【有点意思】自然语言处理","aria-hidden":"true"},"#"),t(" 1.4 【有点意思】自然语言处理")],-1),O={href:"http://www.wenzhihuai.com/weibonlp.html",target:"_blank",rel:"noopener noreferrer"},W=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/QQ截图20170825141127.png",alt:"",tabindex:"0"}),e("figcaption")],-1),Y=e("h2",{id:"总结",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#总结","aria-hidden":"true"},"#"),t(" 总结"),e("br")],-1),$={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"};function ee(te,re){const r=o("ExternalLinkIcon");return i(),a("div",null,[c,e("p",null,[t("各位大佬瞄一眼"),e("a",_,[t("我的个人网站"),n(r)]),t("呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址"),e("a",d,[t("https://github.com/Zephery/newblog"),n(r)]),t(" 。"),p,t(" 大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。")]),u,e("p",null,[t("由原本的ssh变成ssm,再变成ssm+shiro+lucene,到现在的前后台分离。前台使用ssm+lucene,后台使用spring boot+shiro。其中,使用pagehelper作为分页,lucene用来搜索和自动补全,使用百度统计的API做了个日志系统,统计pv和uv什么的,同时,还有使用了JMX来观察JVM的使用和cpu的使用率,机器学习方面,使用了adaboost和朴素贝叶斯对微博进行分类,有兴趣的可以点点"),e("a",g,[t("有点意思"),n(r)]),t("这个页面。"),b,t(" 本文从下面这几个方面来讲讲网站的建立:"),f]),e("ol",null,[e("li",null,[e("a",m,[t("建站故事与网站架构"),n(r)]),w]),e("li",null,[e("a",E,[t("lucene搜索的使用"),n(r)]),B]),e("li",null,[e("a",x,[t("使用quartz来定时备份数据库"),n(r)]),k]),e("li",null,[e("a",v,[t("使用百度统计api做日志系统"),n(r)]),A]),e("li",null,[e("a",y,[t("Nginx小集群的搭建"),n(r)]),V]),z,C,P,S]),j,I,e("p",null,[t("起初,是因为学习的时候老是找不到什么好玩而又有挑战性的项目,看着struts、spring、hibernate的书,全都是一些小项目,做了感觉也没啥意义,有时候在博客园看到别人还有自己的网站,特羡慕,最终就选择了自己做一个个人网站。期初刚学的ssh,于是开始了自己的ssh搭建个人网站的行程,但是对于一个后端的人来说,前端是个大问题啊。。。。所以初版的时候差不多全是纯生的html、css、js,至少发博客这个功能实现了,但是确实没法看。前前后后折腾了一个多月,决定推翻重做,到百度看看别人怎么做的。首先看到的是"),e("a",H,[t("杨青"),n(r)]),t("的网站,已经好几年没更新了,前端的代码看起来比较简单,也是自己能够掌握的,但是不够美观,继续找,在模板之家发现了一个高大上的模板。")]),M,Z,e("p",null,[t("最终版本在考虑时,也找了很多模板,影响深刻的是"),e("a",F,[t("tale"),n(r)]),t("和"),e("a",q,[t("欲思"),n(r)]),t("这两个主题,期中,tale使用的是java语言写的,刚知道的那一刻我就没好感了,java后端我是要自己全部写的,tale这个页面简洁但是不够炫,而且内容量太低,可能就只是个纯博客,之后发现了欲思,拓展性强,只可惜没有静态的版本,后台是纯生的PHP(嗯,PHP是世界上最好的语言),看了看,没事,保存网页,前端自己改,后端自己全部重写,最终变成了现在这个版本,虽然拼接的时候各种css、js混入。。。。还好在做网站性能优化的时候差不多全部去掉了。最终版加入redis、quartz、shiro等,还有python机器学习、flask的restful api,可谓是大杂烩了。"),G,t(" 页面看着还算凑合,至少不是那种看都看不过去的那种了,但是仔细看看,还是有不少问题的,比如瀑布流,还有排版什么的。只能等自己什么时候想认真学学前端的东西了。"),J,t(" 已经部署在腾讯云服务器上,存储使用了七牛云的cdn。")]),R,D,L,e("p",null,[t("网站核心主要采用Spring SpringMVC和Mybatis,下图是当访问一篇博客的时候的运行流程,参考了"),e("a",N,[t("张开涛"),n(r)]),t("的博客。")]),T,e("p",null,[e("a",U,[t("日志系统"),n(r)]),t("曾经尝试采用过ELK,实时监控实在是让人不能不称赞,本地也跑起来了,但是一到服务器,卡卡卡,毕竟(1Ghz CPU、1G内存),只能放弃ELK,采用百度统计。百度统计提供了Tongji API供开发者使用,只是有次数限制,2000/日,实时的话实在有点低,只能统计前几天的PV、UV等开放出来。其实这个存放在mysql也行,不过这些零碎的数据还是放在redis中,方便管理。"),K,t(" 出了日志系统,自己对服务器的一些使用率也是挺关心的,毕竟服务器配置太低,于是利用了使用了tomcat的JMX来对CPU和jvm使用情况进行监控,这两个都是实时的。出了这两个,对内存的分配做了监控,Eden、Survivor、Tenured的使用情况。"),Q]),X,e("p",null,[t("本人大学里的毕业设计就是基于AdaBoost算法的情感分类,学到的东西还是要经常拿出来看看,要不然真的浪费了我这么久努力做的毕业设计啊。构建了一个基本的情感分类小系统,每天抓取微博进行分类存储在MySql上,并使用flask提供Restful API给java调用,可以点击"),e("a",O,[t("这里"),n(r)]),t("尝试(请忽略Google的图片)。目前分类效果不是很明显,准确率大概只有百分之70%,因为训练样本只有500条(找不到训练样本),机器学习真的太依赖样本的标注。这个,只能请教各位路人大神指导指导了。")]),W,Y,e("p",null,[t("断断续续,也总算做了一个能拿得出手仍要遮遮掩掩才能给别人看的网站,哈哈哈哈哈,也劳烦各位帮忙找找bug。前前后后从初学Java EE就一直设想的事也还算有了个了结,以后要多多看书,写点精品文章。PS:"),e("a",$,[t("GitHub上求给个Star"),n(r)]),t(",以后面试能讲讲这个网站。")])])}const oe=l(h,[["render",ee],["__file","1.历史与架构.html.vue"]]);export{oe as default}; diff --git "a/assets/10.\347\275\221\347\253\231\351\207\215\346\236\204.html-B3DJ60R6.js" "b/assets/10.\347\275\221\347\253\231\351\207\215\346\236\204.html-B3DJ60R6.js" new file mode 100644 index 00000000..e76b3a6d --- /dev/null +++ "b/assets/10.\347\275\221\347\253\231\351\207\215\346\236\204.html-B3DJ60R6.js" @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as _,c as o,a as e,d as a}from"./app-hbwtiwmf.js";const c={},r=e("h1",{id:"网站重构",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#网站重构","aria-hidden":"true"},"#"),a(" 网站重构")],-1),s=e("p",null,"因原本的",-1),n=[r,s];function d(i,l){return _(),o("div",null,n)}const m=t(c,[["render",d],["__file","10.网站重构.html.vue"]]);export{m as default}; diff --git "a/assets/10.\347\275\221\347\253\231\351\207\215\346\236\204.html-en6sDsrJ.js" "b/assets/10.\347\275\221\347\253\231\351\207\215\346\236\204.html-en6sDsrJ.js" new file mode 100644 index 00000000..ec24bdba --- /dev/null +++ "b/assets/10.\347\275\221\347\253\231\351\207\215\346\236\204.html-en6sDsrJ.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-523e9724","path":"/personalWebsite/10.%E7%BD%91%E7%AB%99%E9%87%8D%E6%9E%84.html","title":"网站重构","lang":"zh-CN","frontmatter":{"description":"网站重构 因原本的","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/10.%E7%BD%91%E7%AB%99%E9%87%8D%E6%9E%84.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"网站重构"}],["meta",{"property":"og:description","content":"网站重构 因原本的"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"网站重构\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.03,"words":8},"filePathRelative":"personalWebsite/10.网站重构.md","localizedDate":"2024年1月25日","excerpt":"

网站重构

\\n

因原本的

\\n","autoDesc":true}');export{e as data}; diff --git a/assets/1240-20240125205906732-3JnHoeWt.png b/assets/1240-20240125205906732-3JnHoeWt.png new file mode 100644 index 00000000..d65e623f Binary files /dev/null and b/assets/1240-20240125205906732-3JnHoeWt.png differ diff --git a/assets/1240-20240125205916232-uk0gBVIt.png b/assets/1240-20240125205916232-uk0gBVIt.png new file mode 100644 index 00000000..9400dbd7 Binary files /dev/null and b/assets/1240-20240125205916232-uk0gBVIt.png differ diff --git a/assets/1240-20240125205923525--CBzDE9M.png b/assets/1240-20240125205923525--CBzDE9M.png new file mode 100644 index 00000000..30312ef4 Binary files /dev/null and b/assets/1240-20240125205923525--CBzDE9M.png differ diff --git a/assets/1240-20240125205928956-l0-uUrdD.png b/assets/1240-20240125205928956-l0-uUrdD.png new file mode 100644 index 00000000..54a2e88f Binary files /dev/null and b/assets/1240-20240125205928956-l0-uUrdD.png differ diff --git a/assets/1240-20240125205939879-Y6BQ23IR.png b/assets/1240-20240125205939879-Y6BQ23IR.png new file mode 100644 index 00000000..e6cf366c Binary files /dev/null and b/assets/1240-20240125205939879-Y6BQ23IR.png differ diff --git a/assets/1240-20240125205944929-A0LlTV85.png b/assets/1240-20240125205944929-A0LlTV85.png new file mode 100644 index 00000000..14a5be15 Binary files /dev/null and b/assets/1240-20240125205944929-A0LlTV85.png differ diff --git a/assets/1240-20240125205952628-03TY1GXm.png b/assets/1240-20240125205952628-03TY1GXm.png new file mode 100644 index 00000000..c6c123f4 Binary files /dev/null and b/assets/1240-20240125205952628-03TY1GXm.png differ diff --git a/assets/1240-20240125205957133-hc_ibD3B.png b/assets/1240-20240125205957133-hc_ibD3B.png new file mode 100644 index 00000000..1e136493 Binary files /dev/null and b/assets/1240-20240125205957133-hc_ibD3B.png differ diff --git a/assets/1240-20240125210045403-vE_MYP5P.png b/assets/1240-20240125210045403-vE_MYP5P.png new file mode 100644 index 00000000..e0900d42 Binary files /dev/null and b/assets/1240-20240125210045403-vE_MYP5P.png differ diff --git a/assets/1240-20240125210335027-McP_Ljsy.png b/assets/1240-20240125210335027-McP_Ljsy.png new file mode 100644 index 00000000..cc902df9 Binary files /dev/null and b/assets/1240-20240125210335027-McP_Ljsy.png differ diff --git a/assets/1240-20240125210338196-a9YM81Rs.png b/assets/1240-20240125210338196-a9YM81Rs.png new file mode 100644 index 00000000..2e006ca1 Binary files /dev/null and b/assets/1240-20240125210338196-a9YM81Rs.png differ diff --git a/assets/1240-20240125210940819-6188218-cOcDzpSc.png b/assets/1240-20240125210940819-6188218-cOcDzpSc.png new file mode 100644 index 00000000..e56fdee2 Binary files /dev/null and b/assets/1240-20240125210940819-6188218-cOcDzpSc.png differ diff --git a/assets/1240-20240125211018144-_fS9AL1O.png b/assets/1240-20240125211018144-_fS9AL1O.png new file mode 100644 index 00000000..cc32daad Binary files /dev/null and b/assets/1240-20240125211018144-_fS9AL1O.png differ diff --git a/assets/1240-20240125211018162-rl8tLiYu.png b/assets/1240-20240125211018162-rl8tLiYu.png new file mode 100644 index 00000000..702ae9fa Binary files /dev/null and b/assets/1240-20240125211018162-rl8tLiYu.png differ diff --git a/assets/1240-20240125211018163-lTuJ6Fsc.png b/assets/1240-20240125211018163-lTuJ6Fsc.png new file mode 100644 index 00000000..97358074 Binary files /dev/null and b/assets/1240-20240125211018163-lTuJ6Fsc.png differ diff --git a/assets/1240-Bv6EG5xm.png b/assets/1240-Bv6EG5xm.png new file mode 100644 index 00000000..b2113e08 Binary files /dev/null and b/assets/1240-Bv6EG5xm.png differ diff --git a/assets/129qih-to9xnaLl.png b/assets/129qih-to9xnaLl.png new file mode 100644 index 00000000..a86bc261 Binary files /dev/null and b/assets/129qih-to9xnaLl.png differ diff --git a/assets/1620-lNrDunpd.png b/assets/1620-lNrDunpd.png new file mode 100644 index 00000000..b07ec763 Binary files /dev/null and b/assets/1620-lNrDunpd.png differ diff --git a/assets/1mysql.html-S53I0JMm.js b/assets/1mysql.html-S53I0JMm.js new file mode 100644 index 00000000..160a2c4a --- /dev/null +++ b/assets/1mysql.html-S53I0JMm.js @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as s,c as a,a as e,d as o}from"./app-hbwtiwmf.js";const c="/assets/img-kuzmmtyE.png",n={},r=e("h1",{id:"mysql",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#mysql","aria-hidden":"true"},"#"),o(" mysql")],-1),i=e("figure",null,[e("img",{src:c,alt:"img",tabindex:"0"}),e("figcaption",null,"img")],-1),_=[r,i];function l(m,d){return s(),a("div",null,_)}const u=t(n,[["render",l],["__file","1mysql.html.vue"]]);export{u as default}; diff --git a/assets/1mysql.html-iiTeieOx.js b/assets/1mysql.html-iiTeieOx.js new file mode 100644 index 00000000..c91affc3 --- /dev/null +++ b/assets/1mysql.html-iiTeieOx.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-aa93dec0","path":"/database/mysql/1mysql.html","title":"mysql","lang":"zh-CN","frontmatter":{"description":"mysql img","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/mysql/1mysql.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"mysql"}],["meta",{"property":"og:description","content":"mysql img"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"mysql\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.01,"words":3},"filePathRelative":"database/mysql/1mysql.md","localizedDate":"2024年1月24日","excerpt":"

mysql

\\n
img
\\n","autoDesc":true}');export{e as data}; diff --git "a/assets/2.Lucene\347\232\204\344\275\277\347\224\250.html-O-sNKJ-a.js" "b/assets/2.Lucene\347\232\204\344\275\277\347\224\250.html-O-sNKJ-a.js" new file mode 100644 index 00000000..63015e80 --- /dev/null +++ "b/assets/2.Lucene\347\232\204\344\275\277\347\224\250.html-O-sNKJ-a.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-65b5c81c","path":"/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html","title":"2.Lucene的使用","lang":"zh-CN","frontmatter":{"description":"2.Lucene的使用 首先,帮忙点击一下我的网站http://www.wenzhihuai.com/ 。谢谢啊,如果可以,GitHub上麻烦给个star,以后面试能讲讲这个项目,GitHub地址https://github.com/Zephery/newblog 。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"2.Lucene的使用"}],["meta",{"property":"og:description","content":"2.Lucene的使用 首先,帮忙点击一下我的网站http://www.wenzhihuai.com/ 。谢谢啊,如果可以,GitHub上麻烦给个star,以后面试能讲讲这个项目,GitHub地址https://github.com/Zephery/newblog 。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"2.Lucene的使用\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":3,"title":"Lucene的整体架构","slug":"lucene的整体架构","link":"#lucene的整体架构","children":[]},{"level":3,"title":"搜索引擎的几个重要概念:","slug":"搜索引擎的几个重要概念","link":"#搜索引擎的几个重要概念","children":[]},{"level":3,"title":"Lucene中的几个概念","slug":"lucene中的几个概念","link":"#lucene中的几个概念","children":[]},{"level":3,"title":"lucene在本网站的使用:","slug":"lucene在本网站的使用","link":"#lucene在本网站的使用","children":[]},{"level":2,"title":"一、搜索","slug":"一、搜索","link":"#一、搜索","children":[]},{"level":2,"title":"二、lucene自动补全","slug":"二、lucene自动补全","link":"#二、lucene自动补全","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":6.8,"words":2039},"filePathRelative":"personalWebsite/2.Lucene的使用.md","localizedDate":"2024年1月25日","excerpt":"

2.Lucene的使用

\\n

首先,帮忙点击一下我的网站http://www.wenzhihuai.com/ 。谢谢啊,如果可以,GitHub上麻烦给个star,以后面试能讲讲这个项目,GitHub地址https://github.com/Zephery/newblog

","autoDesc":true}');export{e as data}; diff --git "a/assets/2.Lucene\347\232\204\344\275\277\347\224\250.html-dSBaVgnp.js" "b/assets/2.Lucene\347\232\204\344\275\277\347\224\250.html-dSBaVgnp.js" new file mode 100644 index 00000000..48dbd134 --- /dev/null +++ "b/assets/2.Lucene\347\232\204\344\275\277\347\224\250.html-dSBaVgnp.js" @@ -0,0 +1,241 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as c,c as l,a as n,d as s,b as t,e as p}from"./app-hbwtiwmf.js";const i={},u=n("h1",{id:"_2-lucene的使用",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#_2-lucene的使用","aria-hidden":"true"},"#"),s(" 2.Lucene的使用")],-1),r={href:"http://www.wenzhihuai.com/",target:"_blank",rel:"noopener noreferrer"},k={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},d=p(`

Lucene的整体架构

image
image

搜索引擎的几个重要概念:

  1. 倒排索引:将文档中的词作为关键字,建立词与文档的映射关系,通过对倒排索引的检索,可以根据词快速获取包含这个词的文档列表。倒排索引一般需要对句子做去除停用词。

  2. 停用词:在一段句子中,去掉之后对句子的表达意向没有印象的词语,如“非常”、“如果”,中文中主要包括冠词,副词等。

  3. 排序:搜索引擎在对一个关键词进行搜索时,可能会命中许多文档,这个时候,搜索引擎就需要快速的查找的用户所需要的文档,因此,相关度大的结果需要进行排序,这个设计到搜索引擎的相关度算法。

Lucene中的几个概念

  1. 文档(Document):文档是一系列域的组合,文档的域则代表一系列域文档相关的内容。
  2. 域(Field):每个文档可以包含一个或者多个不同名称的域。
  3. 词(Term):Term是搜索的基本单元,与Field相对应,包含了搜索的域的名称和关键词。
  4. 查询(Query):一系列Term的条件组合,成为TermQuery,但也有可能是短语查询等。
  5. 分词器(Analyzer):主要是用来做分词以及去除停用词的处理。

索引的建立

索引的搜索

lucene在本网站的使用:

  1. 搜索 2. 自动分词

一、搜索

注意:本文使用最新的lucene,版本6.6.0。lucene的版本更新很快,每跨越一次大版本,使用方式就不一样。首先需要导入lucene所使用的包。使用maven:

<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-core</artifactId><!--lucene核心-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-analyzers-common</artifactId><!--分词器-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-analyzers-smartcn</artifactId><!--中文分词器-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-queryparser</artifactId><!--格式化-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-highlighter</artifactId><!--lucene高亮-->
+    <version>${lucene.version}</version>
+</dependency>
+
  1. 构建索引
Directory dir = FSDirectory.open(Paths.get("blog_index"));//索引存储的位置
+SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();//简单的分词器
+IndexWriterConfig config = new IndexWriterConfig(analyzer);
+IndexWriter writer = new IndexWriter(dir, config);
+Document doc = new Document();
+doc.add(new TextField("title", blog.getTitle(), Field.Store.YES)); //对标题做索引
+doc.add(new TextField("content", Jsoup.parse(blog.getContent()).text(), Field.Store.YES));//对文章内容做索引
+writer.addDocument(doc);
+writer.close();
+
  1. 更新与删除
IndexWriter writer = getWriter();
+Document doc = new Document();
+doc.add(new TextField("title", blog.getTitle(), Field.Store.YES));
+doc.add(new TextField("content", Jsoup.parse(blog.getContent()).text(), Field.Store.YES));
+writer.updateDocument(new Term("blogid", String.valueOf(blog.getBlogid())), doc);   //更新索引
+writer.close();
+
  1. 查询
private static void search_index(String keyword) {
+    try {
+        Directory dir = FSDirectory.open(Paths.get("blog_index")); //获取要查询的路径,也就是索引所在的位置
+        IndexReader reader = DirectoryReader.open(dir);
+        IndexSearcher searcher = new IndexSearcher(reader);
+        SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();
+        QueryParser parser = new QueryParser("content", analyzer); //查询解析器
+        Query query = parser.parse(keyword); //通过解析要查询的String,获取查询对象
+        TopDocs docs = searcher.search(query, 10);//开始查询,查询前10条数据,将记录保存在docs中,
+        for (ScoreDoc scoreDoc : docs.scoreDocs) { //取出每条查询结果
+            Document doc = searcher.doc(scoreDoc.doc); //scoreDoc.doc相当于docID,根据这个docID来获取文档
+            System.out.println(doc.get("title")); //fullPath是刚刚建立索引的时候我们定义的一个字段
+        }
+        reader.close();
+    } catch (IOException | ParseException e) {
+        logger.error(e.toString());
+    }
+}
+
  1. 高亮
Fragmenter fragmenter = new SimpleSpanFragmenter(scorer);
+SimpleHTMLFormatter simpleHTMLFormatter = new SimpleHTMLFormatter("<b><font color='red'>", "</font></b>");
+Highlighter highlighter = new Highlighter(simpleHTMLFormatter, scorer);
+highlighter.setTextFragmenter(fragmenter);
+for (ScoreDoc scoreDoc : docs.scoreDocs) { //取出每条查询结果
+    Document doc = searcher.doc(scoreDoc.doc); //scoreDoc.doc相当于docID,根据这个docID来获取文档
+    String title = doc.get("title");
+    TokenStream tokenStream = analyzer.tokenStream("title", new StringReader(title));
+    String hTitle = highlighter.getBestFragment(tokenStream, title);
+    System.out.println(hTitle);
+}
+

结果

<b><font color='red'>Java</font></b>堆.栈和常量池 笔记
+
  1. 分页
    目前lucene分页的方式主要有两种:
    (1). 每次都全部查询,然后通过截取获得所需要的记录。由于采用了分词与倒排索引,所有速度是足够快的,但是在数据量过大的时候,占用内存过大,容易造成内存溢出
    (2). 使用searchAfter把数据保存在缓存里面,然后再去取。这种方式对大量的数据友好,但是当数据量比较小的时候,速度会相对慢。
    lucene中使用searchafter来筛选顺序
ScoreDoc lastBottom = null;//相当于pageSize
+BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();
+QueryParser parser1 = new QueryParser("title", analyzer);//对文章标题进行搜索
+Query query1 = parser1.parse(q);
+booleanQuery.add(query1, BooleanClause.Occur.SHOULD);
+TopDocs hits = search.searchAfter(lastBottom, booleanQuery.build(), pagehits);  //lastBottom(pageSize),pagehits(pagenum)
+
`,27),m={start:"6"},v=n("br",null,null,-1),g={href:"https://github.com/Zephery/newblog/blob/master/src/main/java/com/myblog/lucene/BlogIndex.java",target:"_blank",rel:"noopener noreferrer"},b=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/bervererfwaefewf20170903200915.png",alt:"",tabindex:"0"}),n("figcaption")],-1),y=n("h2",{id:"二、lucene自动补全",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#二、lucene自动补全","aria-hidden":"true"},"#"),s(" 二、lucene自动补全")],-1),h=n("p",null,[s("百度、谷歌等在输入文字的时候会弹出补全框,如下图:"),n("br"),n("img",{src:"http://image.wenzhihuai.com/QQ截图20170728102929.png",alt:""})],-1),w={href:"https://github.com/xdan/autocomplete/",target:"_blank",rel:"noopener noreferrer"},f=n("br",null,null,-1),x={href:"http://iamyida.iteye.com/blog/2205114",target:"_blank",rel:"noopener noreferrer"},_={href:"http://blog.csdn.net/u011389474/article/details/69458445",target:"_blank",rel:"noopener noreferrer"},S=p(`

使用:

  1. 导入maven包
<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-suggest</artifactId>
+    <version>6.6.0</version>
+</dependency>
+
  1. 如果想将结果反序列化,声明实体类的时候要加上:
public class Blog implements Serializable {
+
  1. 实现InputIterator接口
InputIterator的几个方法:
+long weight():返回的权重值,大小会影响排序,默认是1L
+BytesRef payload():对某个对象进行序列化
+boolean hasPayloads():是否有设置payload信息
+Set<BytesRef> contexts():存入context,context里可以是任意的自定义数据,一般用于数据过滤
+boolean hasContexts():判断是否有下一个,默认为false
+
public class BlogIterator implements InputIterator {
+    /**
+     * logger
+     */
+    private static final Logger logger = LoggerFactory.getLogger(BlogIterator.class);
+    private Iterator<Blog> blogIterator;
+    private Blog currentBlog;
+
+    public BlogIterator(Iterator<Blog> blogIterator) {
+        this.blogIterator = blogIterator;
+    }
+
+    @Override
+    public boolean hasContexts() {
+        return true;
+    }
+
+    @Override
+    public boolean hasPayloads() {
+        return true;
+    }
+
+    public Comparator<BytesRef> getComparator() {
+        return null;
+    }
+
+    @Override
+    public BytesRef next() {
+        if (blogIterator.hasNext()) {
+            currentBlog = blogIterator.next();
+            try {
+                //返回当前Project的name值,把blog类的name属性值作为key
+                return new BytesRef(Jsoup.parse(currentBlog.getTitle()).text().getBytes("utf8"));
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 将Blog对象序列化存入payload
+     * 可以只将所需要的字段存入payload,这里对整个实体类进行序列化,方便以后需求,不建议采用这种方法
+     */
+    @Override
+    public BytesRef payload() {
+        try {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream(bos);
+            out.writeObject(currentBlog);
+            out.close();
+            BytesRef bytesRef = new BytesRef(bos.toByteArray());
+            return bytesRef;
+        } catch (IOException e) {
+            logger.error("", e);
+            return null;
+        }
+    }
+
+    /**
+     * 文章标题
+     */
+    @Override
+    public Set<BytesRef> contexts() {
+        try {
+            Set<BytesRef> regions = new HashSet<BytesRef>();
+            regions.add(new BytesRef(currentBlog.getTitle().getBytes("UTF8")));
+            return regions;
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException("Couldn't convert to UTF-8");
+        }
+    }
+
+    /**
+     * 返回权重值,这个值会影响排序
+     * 这里以产品的销售量作为权重值,weight值即最终返回的热词列表里每个热词的权重值
+     */
+    @Override
+    public long weight() {
+        return currentBlog.getHits();   //change to hits
+    }
+}
+
  1. ajax 建立索引
/**
+ * ajax建立索引
+ */
+@Override
+public void ajaxbuild() {
+    try {
+        Directory dir = FSDirectory.open(Paths.get("autocomplete"));
+        SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();
+        AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(dir, analyzer);
+        //创建Blog测试数据
+        List<Blog> blogs = blogMapper.getAllBlog();
+        suggester.build(new BlogIterator(blogs.iterator()));
+    } catch (IOException e) {
+        System.err.println("Error!");
+    }
+}
+
  1. 查找
    因为有些文章的标题是一样的,先对list排序,将标题短的放前面,长的放后面,然后使用LinkHashSet来存储。
@Override
+public Set<String> ajaxsearch(String keyword) {
+    try {
+        Directory dir = FSDirectory.open(Paths.get("autocomplete"));
+        SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();
+        AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(dir, analyzer);
+        List<String> list = lookup(suggester, keyword);
+        list.sort(new Comparator<String>() {
+            @Override
+            public int compare(String o1, String o2) {
+                if (o1.length() > o2.length()) {
+                    return 1;
+                } else {
+                    return -1;
+                }
+            }
+        });
+        Set<String> set = new LinkedHashSet<>();
+        for (String string : list) {
+            set.add(string);
+        }
+        ssubSet(set, 7);
+        return set;
+    } catch (IOException e) {
+        System.err.println("Error!");
+        return null;
+    }
+}
+
  1. controller层
@RequestMapping("ajaxsearch")
+public void ajaxsearch(HttpServletRequest request, HttpServletResponse response) throws IOException {
+    String keyword = request.getParameter("keyword");
+    if (StringUtils.isEmpty(keyword)) {
+        return;
+    }
+    Set<String> set = blogService.ajaxsearch(keyword);
+    Gson gson = new Gson();
+    response.getWriter().write(gson.toJson(set));//返回的数据使用json
+}
+
`,14),q={start:"7"},j=n("br",null,null,-1),I={href:"https://github.com/xdan/autocomplete",target:"_blank",rel:"noopener noreferrer"},B=p(`
<link rel="stylesheet" href="js/autocomplete/jquery.autocomplete.css">
+<script src="js/autocomplete/jquery.autocomplete.js" type="text/javascript"></script>
+<script type="text/javascript">
+    /******************** remote start **********************/
+    $('#remote_input').autocomplete({
+        source: [
+            {
+                url: "ajaxsearch.html?keyword=%QUERY%",
+                type: 'remote'
+            }
+        ]
+    });
+    /********************* remote end ********************/
+</script>
+
  1. 效果:
`,2),z={id:"欢迎访问我的个人网站",tabindex:"-1"},D=n("a",{class:"header-anchor",href:"#欢迎访问我的个人网站","aria-hidden":"true"},"#",-1),T={href:"http://www.wenzhihuai.com/",target:"_blank",rel:"noopener noreferrer"},F=n("br",null,null,-1),O={href:"https://www.ibm.com/developerworks/cn/java/j-lo-lucene1/",target:"_blank",rel:"noopener noreferrer"},R={href:"http://iamyida.iteye.com/blog/2205114",target:"_blank",rel:"noopener noreferrer"};function E(L,C){const a=o("ExternalLinkIcon");return c(),l("div",null,[u,n("p",null,[s("首先,帮忙点击一下我的网站"),n("a",r,[s("http://www.wenzhihuai.com/"),t(a)]),s(" 。谢谢啊,如果可以,GitHub上麻烦给个star,以后面试能讲讲这个项目,GitHub地址"),n("a",k,[s("https://github.com/Zephery/newblog"),t(a)]),s(" 。")]),d,n("ol",m,[n("li",null,[s("使用效果"),v,s(" 全部代码放在"),n("a",g,[s("这里"),t(a)]),s(",代码写的不太好,光从代码规范上就不咋地。在网页上的使用效果如下:")])]),b,y,h,n("p",null,[s("在搭建lucene自动补全的时候,也有考虑过使用SQL语句中使用like来进行,主要还是like对数据库压力会大,而且相关度没有lucene的高。主要使用了官方suggest库以及"),n("a",w,[s("autocompelte.js"),t(a)]),s("这个插件。"),f,s(" suggest的原理"),n("a",x,[s("看这"),t(a)]),s(",以及索引结构"),n("a",_,[s("看这"),t(a)]),s("。")]),S,n("ol",q,[n("li",null,[s("ajax来提交请求"),j,s(" autocomplete.js源代码与介绍:"),n("a",I,[s("https://github.com/xdan/autocomplete"),t(a)])])]),B,n("h4",z,[D,s(" 欢迎访问我的"),n("a",T,[s("个人网站"),t(a)])]),n("p",null,[s("参考:"),F,n("a",O,[s("https://www.ibm.com/developerworks/cn/java/j-lo-lucene1/"),t(a)])]),n("p",null,[n("a",R,[s("http://iamyida.iteye.com/blog/2205114"),t(a)])])])}const H=e(i,[["render",E],["__file","2.Lucene的使用.html.vue"]]);export{H as default}; diff --git a/assets/2017.html-AdKOrP-m.js b/assets/2017.html-AdKOrP-m.js new file mode 100644 index 00000000..79f36690 --- /dev/null +++ b/assets/2017.html-AdKOrP-m.js @@ -0,0 +1 @@ +import{_ as r}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as p,c as h,a as i,d as e,b as t,e as n}from"./app-hbwtiwmf.js";const g={},c=i("p",null,[e("2016年6月,大三,考完最后一科,默默的看着大四那群人一个一个的走了,想着想着,明年毕业的时候,自己将会失去你所拥有的一切,大学那群认识的人,可能这辈子都不会见到了——致远离家乡出省读书的娃。然而,我并没有想到,自己失去的,不仅仅是那群人,几乎是一切。。。。"),i("br"),e(" 17年1月,因为受不了北京雾霾(其实是次因),从实习的公司跑路了,很不舍,只是,感觉自己还有很多事要做,很多梦想要去实现,毕竟,看着身边的人,去了美团,拿着15k的月薪,有点不平衡,感觉他也不是很厉害吧,我努力努力10k应该没问题吧?")],-1),s=i("figure",null,[i("img",{src:"http://image.wenzhihuai.com/images/20171231044153.png",alt:"",tabindex:"0"}),i("figcaption")],-1),u=i("p",null,"回到学校,待了几天,那个整天给别人灌毒鸡汤的人还是不着急找工作:该有的时候总会有的啦,然后继续打游戏、那个天天喊着吃麻辣香锅的人,记忆中好像今年都没有吃上,哈哈、厕所还是那样偶尔炸一下,嗯,感觉一切都很熟悉,只是,我有了点伤感,毕竟身边又要换一群不认识的人了。考完试,终于能回广东了,一年没回了,开心不得了,更多的是,为了那个喜欢了好几年没有表白的妹纸,之前从没想过真的能每天跟一个妹纸道晚安,秒回,但是,对她,我还真做到了。1月份的广州,不热不冷,空气很清新,比北京、天津那股泥土味好多了,只是,我被拒了,男闺蜜还是男闺蜜,备胎还是备胎,那会还没想过放弃,直到...",-1),d={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},f=n('

疲惫的面试历程

2月份底开始慢慢投简历,跑招聘会,深圳招聘的太少了,那就去广州,大学城,于是,开始了自己一周两天都在广深往返。有的公司笔试要跑一次广州,一面要跑一次,二面还要跑一次,每次看着路费,真的承受不起,但是有希望就行。乐观之下,到来的是一重又一重的打击。

**数码,很看好的公司,在广州也算是老品牌了,笔试的时候面试官没有带够卷子,就拿了大数据的做,还过了,面试的时候被面到union和union all的区别,答反了,还有left join和right join的原理,一脸懵逼,过后去了百度搜了搜,这东西哪来的原理?

然后是个企业建站的,笔试完了,面试官照着题问然后没说啥就让我走了,额,我好像还没自我介绍呢。

有点想回北京了,往北京投了一份,A轮公司,月薪10k,过了,觉得自己技术应该不差吧,不过还是拒了,因为一想起那里满脑子都是雾霾。

没事没事,下一家,某游戏公司,笔试过了,一面也过了,然后被问flume收集的时候断网处理机制、MD5和RSA原理、Angulajs和Vuejs用没用过、千万级的数据是如何存储的?额,跟你们想的一样,我一道也答出来,然后就挂了,面试官跟我说,你要是来早三个月这些都会啦,说的我很紧张,广东的同学都那么强么?

这个时候还没质疑自己的技术,去了趟深圳某家小公司,金融的,HR问我是不是培训过来的,心里开始突然间好苦涩,大学花那么多时间学习居然被别人用来和培训机构的人相提并论,笔试不知从哪整来的英文逻辑题,做完了然后上机笔试,做不出来不能见面试官,开始感觉这公司有点。。。。还是撤了撤了。

突然感觉面试面的绝望,是自己的问题么?是自己技术太菜了么?开始怀疑自己,感觉也是,已经3月份底了,毕竟别人都在实习,而我已经离职3个月没工作了,但是那些问题不是有点离谱了,一开始是开始心态爆炸觉得怎么可以对应届生问这些问题,不应该是基础么?算法什么的,后来是无奈了,开始上网搜各种不沾边的技术。

还有其他的面试。。。有的工资不高(6K不到),有的面试问题全答对就因为说了有点想做大数据就不要你,有的聊得很欢快却没消息,有的说招java但是笔试一道java题都没有全是前端的,有的打着互联网实际却是外包的公司。。。。
  4月初真的很绝望很绝望,不想跟别人说话,是不是很可笑,一个从北京B+轮的公司回广东,面试近15个,居然只能拿到2个offer,其中之一国企外包的,都不知说什么好。13号要拍毕业照了,没有回去,大学四年,毕竟大家个个圈子之间没什么交流,没什么友谊,果然,整个专业的人只有2/3的人去拍了毕业照。4月23号,拉勾网深圳站,梦想着市集,抱着一点点的小希望,去投了5个,结果一个面试邀请都没有,换之而来的是一片绝望、黑暗。。。。

感情、我们毕业了

5月初回学校了赶毕业设计,回学校也是,天天往图书馆跑,为了面试,毕业设计拉下太多了。悠闲的时候,总会想起我喜欢的那个人,过的怎么样了,微信一开,好像自己被屏蔽了还是被删了?这三个月来的面试打击,真的不知道怎么应对,我更不知道怎么跟她聊天,以至于慢慢隔离,这段感情,或许只有我知道自己有多心疼,只有我自己sb得一点点的呵护着。想起上次跟她聊天是4月中,还是她提了个问题其他什么都没问,彼此之前已经没有关心了。删了吧删了吧,就这样一句再见都没有说,一句“祝福”都没有说。
  5月底遇到两次还算开心的事,导师问我要不要评优秀论文,不是很想折腾,拒了,导师仍旧劝我,只是写个3页的小总结而已,评上的话能留图书馆收藏。另一个件是珍爱网打电话过来说我一面过了,什么时候二面,天啊,3月份一面,5月底才通知,心里想骂,但是真的好开心好开心,黑暗中的光芒,泪奔。。。。约到了6月15号面试。
  6月初开始自己的回家倒计时,请那唯一一个跟我好的妹纸吃饭,忙完答辩,然后是优秀论文的小报告,13号下午交了上去,再回到宿舍,空无一人,一遍忍着不要悲伤,一遍收拾东西,然后向每个宿舍敲门,告别,一个人拖着行李箱,嗯,我要淡定。

准备了有点久,我以为自己准备好了,15号,深圳,珍爱网,被问到:有没有JVM调优经验?ZK是如何保持一致性的?有没有写过ELK索引经验?谈谈你对dubbo的理解。。。事后,得知自己没有过。心态真的炸了,通宵打了两天游戏。月底得知,优秀论文也没有被评上,已经没有骂人吐槽的想法,只是哦的一声,6月,宣告了自己春招结束,宣告自己要去外包,同时也宣告自己大学这些努力全部白费,跟那个灌毒鸡汤天天打游戏的人同一起跑线。

996的工作

七月初入职的时候,问了问那些一起应届入职的同学,跟别人交流一下面试被问的问题,只有线程池,JVM回收算法,他们也没用过,我无奈,为什么我被问到的,全是Angularjs、MD5加密算法、ZK一致性原理这种奇葩的问题。。。。。

',16),m={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},l=n('

决心先好好呆着,学习学习,把公司的产品业务技术专研专研,7、8月份是挺开心的,没怎么加班,虽然下班我都留在公司学习,虽然公司的产品不咋地,但是还是有可学之处的,随后,我没想到的是,公司要实行996,,,9月份至12月,每天都是改bug,开发模块,写业务,全都是增删改查,没有涉及redis、rabbitmq,就真的只有使用Hibernate、spring,而做出的东西,要使用JDK6来运行,至今都能看到sun的类。每天的状态就是累累累,我们组还不是最惨的,隔壁项目组,一周通宵两次,9月到10都是如此,国庆加班,每次经过他们组,我都觉得自己还算是幸福。很厌恶这种不把员工当人看的行为,有同事调侃,明年估计我们这些应届过来的,是不是要走掉2/3的人?疯狂加班的代价是牺牲积极性,我问过那些一周通宵两次的人,敲代码,程序员你喜欢这份工作么?不喜欢!!!有那么一两次,实在是太累了,我都感觉自己有点不行了,想离职,可是,会有公司要我么?会有公司不问那些奇葩的问题么?

双十一,花了500多买了十本书,神书啊,计算机届的圣经啊,然而至今一本都没看完,甚至是都没怎么翻,每天下班回去之后就是9点半了,烧水,洗澡,洗衣服,近11点了,躺床上,一遍看书一遍看鹌鹑直播,一小时才翻几页,996真的太累了,实在看不下书。经过这几个月的加班,感觉自己技术增长为负数,也病了几次,同学见我,都感觉我老了不少,心里不平,可是又没有什么办法。

孤独

珠江新城,一年四季都那么美,今晚应该又是万人一起倒计时了吧?已经好久没跟别人一起出去玩过了。今年貌似得了自闭症?社交全靠黄段子。想找人出门走走,然而手机已经没有那种几年的朋友,大学同学一个都不在,哈哈哈,别人说社交软件让人离得更近,我怎么发现我自己一个好朋友都没有了呢,哭笑ing。或许是自己的确不善于跟别人保持联系吧,这个要改,一定要改!!!
远看:

近看:

题外话:
有些时候,遇到不顺,感觉自己不是神,没必要忍住,就开始宣泄自己的情绪,比如疯狂打游戏,只能这样度过了吧。
今年听过最多的一句话,你好厉害,你好牛逼==我感觉也是,可惜,要被业务耽误了不少时间吧。。
《企业IT架构转型之道》是今年最好的架构图书,没有之一。

期望

想起初中,老师让我在黑板写自己的英文作文,好像是信件,描述什么状况来这?最后夸了夸我在文章后面加的一段大概是劝别人不要悲伤要灿烂。也想起一个故事,二战以后,德国满目疮痍,他们处在这样一个凄惨的境地,还能想到在桌上摆设一些花,就一定能在废墟上重建家园。我所看到的是即使在再黑暗的状态下,要永远抱着希望。明年要更加努力的学习,而不是工作,是该挽留一些人了,多运动。说了那么多,其实,我只希望自己的运气不要再差了,再差就没法活了。人在遇到不顺的时候,往往最难过的一关便是自己。哈哈哈,只能学我那个同学给自己灌毒鸡汤了。加油加油↖(^ω^)↗

',13);function b(_,w){const a=o("ExternalLinkIcon");return p(),h("div",null,[c,s,u,i("p",null,[e("春节期间,把自己的"),i("a",d,[e("网站"),t(a)]),e("整理了一下,看了看JVM和并发的知识,偶尔刷刷牛客网的题,觉得自己没多大问题了,跟同学出发,去深圳,我并没有一个做马化腾、马云的梦,但是我想,要做出点东西,至少,不是个平庸的人。投了几个,第一个面试,知道是培训兼外包后果断弃了,春招还没开始,再多准备准备,有时间就往深圳图书馆里跑,找个位置,静静的复习,那会,感觉自己一定能去个大公司吧,搞搞分布式、大数据之类的~")]),f,i("p",null,[e("没有环境,就自己创造,下班有时间就改改自己的网站"),i("a",m,[e("http://www.wenzhihuai.com"),t(a)]),e(",GitHub目前有154个star了,感觉也是个小作品吧,把常用的Java技术栈(RabbitMQ、MongoDB等)加了上去,虽然没啥使用场景,但是自己好好努力吧,毕竟高并发、高可用是自己的梦想。今年GitHub自己的提交次数。")]),l])}const k=r(g,[["render",b],["__file","2017.html.vue"]]);export{k as default}; diff --git a/assets/2017.html-XqDiNQIB.js b/assets/2017.html-XqDiNQIB.js new file mode 100644 index 00000000..8e7f6f26 --- /dev/null +++ b/assets/2017.html-XqDiNQIB.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-22e4234a","path":"/life/2017.html","title":"","lang":"zh-CN","frontmatter":{"description":"2016年6月,大三,考完最后一科,默默的看着大四那群人一个一个的走了,想着想着,明年毕业的时候,自己将会失去你所拥有的一切,大学那群认识的人,可能这辈子都不会见到了——致远离家乡出省读书的娃。然而,我并没有想到,自己失去的,不仅仅是那群人,几乎是一切。。。。 17年1月,因为受不了北京雾霾(其实是次因),从实习的公司跑路了,很不舍,只是,感觉自己还有很多事要做,很多梦想要去实现,毕竟,看着身边的人,去了美团,拿着15k的月薪,有点不平衡,感觉他也不是很厉害吧,我努力努力10k应该没问题吧?","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/life/2017.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"2016年6月,大三,考完最后一科,默默的看着大四那群人一个一个的走了,想着想着,明年毕业的时候,自己将会失去你所拥有的一切,大学那群认识的人,可能这辈子都不会见到了——致远离家乡出省读书的娃。然而,我并没有想到,自己失去的,不仅仅是那群人,几乎是一切。。。。 17年1月,因为受不了北京雾霾(其实是次因),从实习的公司跑路了,很不舍,只是,感觉自己还有很多事要做,很多梦想要去实现,毕竟,看着身边的人,去了美团,拿着15k的月薪,有点不平衡,感觉他也不是很厉害吧,我努力努力10k应该没问题吧?"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":11.22,"words":3365},"filePathRelative":"life/2017.md","localizedDate":"2024年1月24日","excerpt":"

2016年6月,大三,考完最后一科,默默的看着大四那群人一个一个的走了,想着想着,明年毕业的时候,自己将会失去你所拥有的一切,大学那群认识的人,可能这辈子都不会见到了——致远离家乡出省读书的娃。然而,我并没有想到,自己失去的,不仅仅是那群人,几乎是一切。。。。
\\n17年1月,因为受不了北京雾霾(其实是次因),从实习的公司跑路了,很不舍,只是,感觉自己还有很多事要做,很多梦想要去实现,毕竟,看着身边的人,去了美团,拿着15k的月薪,有点不平衡,感觉他也不是很厉害吧,我努力努力10k应该没问题吧?

\\n
\\"\\"
","autoDesc":true}');export{e as data}; diff --git a/assets/2018.html-AaAxXJ4o.js b/assets/2018.html-AaAxXJ4o.js new file mode 100644 index 00000000..aa5f0456 --- /dev/null +++ b/assets/2018.html-AaAxXJ4o.js @@ -0,0 +1 @@ +import{_ as n}from"./plugin-vue_export-helper-x3n3nnut.js";import{r,o,c,a,d as e,b as t,e as h}from"./app-hbwtiwmf.js";const s={},l=a("p",null,"年底老姐结婚,跑回家去了,忙着一直没写,本来想回深圳的时候空余的时候写写,没想到一直加班,嗯,9点半下班那种,偶尔也趁着间隙的时间,一段一段的凑着吧。",-1),d={href:"https://www.cnblogs.com/w1570631036/p/8158284.html",target:"_blank",rel:"noopener noreferrer"},p=a("h2",{id:"心惊胆战的裸辞经历",tabindex:"-1"},[a("a",{class:"header-anchor",href:"#心惊胆战的裸辞经历","aria-hidden":"true"},"#"),e(" 心惊胆战的裸辞经历")],-1),g=a("br",null,null,-1),f={href:"https://www.cnblogs.com/w1570631036/p/8549333.html",target:"_blank",rel:"noopener noreferrer"},u=h('

and ... 广州拜拜,晚上人少的时候,跟妹纸去珠江新城真的很美好

工作工作

入职的时候是做日志收集的,就是flume+kafka+es这一套,遇到了不少大佬,嗯,感觉挺好的,打算好好干,一个半月后不知怎么滴,被拉去做容器云了,然后就开始了天天调jenkins、gitlab这些没什么用的api,开始了增删改查的历程,很烦,研究jenkins、gitlab对于自己的技术没什么提升,又不得不做,而且大小周+加班这么做,回到家自己看java、netty、golang的书籍,可是没项目做没实践,过几个月就忘光了,有段时间真的很烦很烦,根本不想工作,天天调api,而且是jenkins、gitlab这些没什么卵用的api,至今也没找到什么办法。。。。
公司发展太快,也实在让人不知所措,一不小心部门被架空了,什么预兆都没有,被分到其他部门,然后发现这个部门领导内斗真的是,“三国争霸”吧,无奈成为炮灰,不同的领导不同的要求,安安静静敲个代码怎么这么难。。。。
去年的学习拉下了不少,文章也写的少了,总写那些入门的文章确实没有什么意思,买的书虽然没有17年的多吧,不过也不少了,也看了挺多本书的,虽然我还是不满意自己的阅读量。
这几年要开始抓准一个框架了,好好专研一下,也要开始学习一下go了,希望能参与一些github的项目,好好努力吧。

跑步跑步

平时没事总是宅在家里打游戏,差不多持续到下半年吧,那会打游戏去楼下吃东西的时候老是觉得眼神恍惚,盯着电子产品太多了,然后就跟别人跑步去了,每周去一次人才公园,跑步健身,人才公园真的是深圳跑步最好的一个地方了,桥上总有一群摄影师,好想在深圳湾买一套房子,看了看房价,算了算了,深圳的房,真的贵的离谱。19年也要多多运动,健康第一健康第一。

Others

  1. 拿到了深圳户口,全程只花了15天,感谢学妹and家人
  2. 买了第一台MacBook Pro,对于Java的我真心不好用
  3. 盼了好几年的老姐结婚,18年终于了解了这心事
  4. 养了只猫,在经历了好几个月的早起之后,晚上睡觉锁厨房,终于安分了,对不起了哈哈哈

2019

想不起来还有什么要说的了,毕竟程序员,好像每天的生活都一样,就展望一下19年吧。今年,最最重要的是家里人以及身边还有所有人都健健康康的,哈哈哈。然后是安安静静的敲代码~~就酱

',13);function _(m,b){const i=r("ExternalLinkIcon");return o(),c("div",null,[l,a("p",null,[e("想着17年12月31号写的那篇文章"),a("a",d,[e("https://www.cnblogs.com/w1570631036/p/8158284.html"),t(i)]),e(",感叹18年还算恢复了点。")]),p,a("p",null,[e("其实校招过去的那家公司,真的不是很喜欢,996、技术差、产品差,实在受不了,春节前提出了离职,老大也挽留了下,以“来了个阿里的带我们重构,能学不了东西”来挽留,虽然我对技术比较痴迷,但离职去深圳的决心还是没有动摇,嗯,就这么开始了自己的裸辞过程。3月8号拿到离职,回公司的时候跟跟同事吹吹水,吃个饭,某同事还喊:“周末来公司玩玩么,我给你开门”,哈哈哈,泼出去的水,回不去了,偶尔有点伤感。"),g,e(" 去深圳面试,第一家随手记,之前超级想去这家公司的,金融这一块,有钱,只可惜,没过,一面面试官一直夸我,我觉得稳了,二面没转过来,就这么挂了,有点不甘心吧,在这,感谢那个内推我的人吧,"),a("a",f,[e("面经在这"),t(i)]),e(",之后就是大大小小的面试,联想、恒大、期待金融什么的,都没拿到offer,裸辞真的慌得一比,一天没工作,感觉一年没有工作没人要的样子。。。。没面试就跑去广州图书馆,复习,反思,一天一天的过着,回家就去楼下吃烧烤,打游戏,2点3点才睡觉,boss直聘、拉勾网见一个问一个,迷迷糊糊慌慌张张,那段期间真的想有点把所有书卖掉回家啃老的想法,好在最后联系了一家公司,电商、大小周,知乎上全是差评,不过评价的都不是技术的,更重要的是,岗位是中间件的,嗯,去吧。")]),u])}const k=n(s,[["render",_],["__file","2018.html.vue"]]);export{k as default}; diff --git a/assets/2018.html-eRg7gPn8.js b/assets/2018.html-eRg7gPn8.js new file mode 100644 index 00000000..9a9ae249 --- /dev/null +++ b/assets/2018.html-eRg7gPn8.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-1f7a720c","path":"/life/2018.html","title":"","lang":"zh-CN","frontmatter":{"description":"年底老姐结婚,跑回家去了,忙着一直没写,本来想回深圳的时候空余的时候写写,没想到一直加班,嗯,9点半下班那种,偶尔也趁着间隙的时间,一段一段的凑着吧。 想着17年12月31号写的那篇文章https://www.cnblogs.com/w1570631036/p/8158284.html,感叹18年还算恢复了点。 心惊胆战的裸辞经历 其实校招过去的那家公司,真的不是很喜欢,996、技术差、产品差,实在受不了,春节前提出了离职,老大也挽留了下,以“来了个阿里的带我们重构,能学不了东西”来挽留,虽然我对技术比较痴迷,但离职去深圳的决心还是没有动摇,嗯,就这么开始了自己的裸辞过程。3月8号拿到离职,回公司的时候跟跟同事吹吹水,吃个饭,某同事还喊:“周末来公司玩玩么,我给你开门”,哈哈哈,泼出去的水,回不去了,偶尔有点伤感。 去深圳面试,第一家随手记,之前超级想去这家公司的,金融这一块,有钱,只可惜,没过,一面面试官一直夸我,我觉得稳了,二面没转过来,就这么挂了,有点不甘心吧,在这,感谢那个内推我的人吧,面经在这,之后就是大大小小的面试,联想、恒大、期待金融什么的,都没拿到offer,裸辞真的慌得一比,一天没工作,感觉一年没有工作没人要的样子。。。。没面试就跑去广州图书馆,复习,反思,一天一天的过着,回家就去楼下吃烧烤,打游戏,2点3点才睡觉,boss直聘、拉勾网见一个问一个,迷迷糊糊慌慌张张,那段期间真的想有点把所有书卖掉回家啃老的想法,好在最后联系了一家公司,电商、大小周,知乎上全是差评,不过评价的都不是技术的,更重要的是,岗位是中间件的,嗯,去吧。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/life/2018.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"年底老姐结婚,跑回家去了,忙着一直没写,本来想回深圳的时候空余的时候写写,没想到一直加班,嗯,9点半下班那种,偶尔也趁着间隙的时间,一段一段的凑着吧。 想着17年12月31号写的那篇文章https://www.cnblogs.com/w1570631036/p/8158284.html,感叹18年还算恢复了点。 心惊胆战的裸辞经历 其实校招过去的那家公司,真的不是很喜欢,996、技术差、产品差,实在受不了,春节前提出了离职,老大也挽留了下,以“来了个阿里的带我们重构,能学不了东西”来挽留,虽然我对技术比较痴迷,但离职去深圳的决心还是没有动摇,嗯,就这么开始了自己的裸辞过程。3月8号拿到离职,回公司的时候跟跟同事吹吹水,吃个饭,某同事还喊:“周末来公司玩玩么,我给你开门”,哈哈哈,泼出去的水,回不去了,偶尔有点伤感。 去深圳面试,第一家随手记,之前超级想去这家公司的,金融这一块,有钱,只可惜,没过,一面面试官一直夸我,我觉得稳了,二面没转过来,就这么挂了,有点不甘心吧,在这,感谢那个内推我的人吧,面经在这,之后就是大大小小的面试,联想、恒大、期待金融什么的,都没拿到offer,裸辞真的慌得一比,一天没工作,感觉一年没有工作没人要的样子。。。。没面试就跑去广州图书馆,复习,反思,一天一天的过着,回家就去楼下吃烧烤,打游戏,2点3点才睡觉,boss直聘、拉勾网见一个问一个,迷迷糊糊慌慌张张,那段期间真的想有点把所有书卖掉回家啃老的想法,好在最后联系了一家公司,电商、大小周,知乎上全是差评,不过评价的都不是技术的,更重要的是,岗位是中间件的,嗯,去吧。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"心惊胆战的裸辞经历","slug":"心惊胆战的裸辞经历","link":"#心惊胆战的裸辞经历","children":[]},{"level":2,"title":"工作工作","slug":"工作工作","link":"#工作工作","children":[]},{"level":2,"title":"跑步跑步","slug":"跑步跑步","link":"#跑步跑步","children":[]},{"level":2,"title":"Others","slug":"others","link":"#others","children":[]},{"level":2,"title":"2019","slug":"_2019","link":"#_2019","children":[]}],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":4.35,"words":1305},"filePathRelative":"life/2018.md","localizedDate":"2024年1月24日","excerpt":"

年底老姐结婚,跑回家去了,忙着一直没写,本来想回深圳的时候空余的时候写写,没想到一直加班,嗯,9点半下班那种,偶尔也趁着间隙的时间,一段一段的凑着吧。

\\n

想着17年12月31号写的那篇文章https://www.cnblogs.com/w1570631036/p/8158284.html,感叹18年还算恢复了点。

\\n

心惊胆战的裸辞经历

\\n

其实校招过去的那家公司,真的不是很喜欢,996、技术差、产品差,实在受不了,春节前提出了离职,老大也挽留了下,以“来了个阿里的带我们重构,能学不了东西”来挽留,虽然我对技术比较痴迷,但离职去深圳的决心还是没有动摇,嗯,就这么开始了自己的裸辞过程。3月8号拿到离职,回公司的时候跟跟同事吹吹水,吃个饭,某同事还喊:“周末来公司玩玩么,我给你开门”,哈哈哈,泼出去的水,回不去了,偶尔有点伤感。
\\n去深圳面试,第一家随手记,之前超级想去这家公司的,金融这一块,有钱,只可惜,没过,一面面试官一直夸我,我觉得稳了,二面没转过来,就这么挂了,有点不甘心吧,在这,感谢那个内推我的人吧,面经在这,之后就是大大小小的面试,联想、恒大、期待金融什么的,都没拿到offer,裸辞真的慌得一比,一天没工作,感觉一年没有工作没人要的样子。。。。没面试就跑去广州图书馆,复习,反思,一天一天的过着,回家就去楼下吃烧烤,打游戏,2点3点才睡觉,boss直聘、拉勾网见一个问一个,迷迷糊糊慌慌张张,那段期间真的想有点把所有书卖掉回家啃老的想法,好在最后联系了一家公司,电商、大小周,知乎上全是差评,不过评价的都不是技术的,更重要的是,岗位是中间件的,嗯,去吧。

","autoDesc":true}');export{e as data}; diff --git a/assets/2019.html-EnqiAe59.js b/assets/2019.html-EnqiAe59.js new file mode 100644 index 00000000..17f80cfd --- /dev/null +++ b/assets/2019.html-EnqiAe59.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as a,c as i,e as r}from"./app-hbwtiwmf.js";const t={},n=r('

2019,本命年,1字头开头的年份,就这么过去了,迎来了2开头的十年,12月过的不是很好,每隔几天就吵架,都没怎么想起写自己的年终总结了,对这个跨年也不是很重视,貌似有点浑浑噩噩的样子。今天1号,就继续来公司学习学习,就写写文章吧。
19年一月,没发生什么事,对老板也算是失望,打算过完春节就出去外面试试,完全的架构错误啊,怎么守得了,然后开了个年会,没什么好看的,唯一的例外就是看见漂漂亮亮的她,可惜不敢搭话,就这么的呗。2月以奇奇怪怪的方式走到了一起,开心,又有点伤心,然后就开始了这个欢喜而又悲剧的本命年。

工作

从18年底开始吧,大概就知道领导对容器云这么快的完全架构设计错误,就是一个完完全全错误的产品,其他人也觉得有点很有问题,但老板就是固执不听,结果一个跑路,一个被压得懒得反抗,然后我一个人跟老板和项目经理怼了前前后后半年,真是惨啊,还要被骂,各种拉到小黑屋里批斗,一直在对他们强调:没有这么做的!!!然后被以年轻人,不懂事,不要抱怨,长大了以后就领会了怼回来,当时气得真是无语。。。。。自己调研的阿里云、腾讯云、青云,还有其他小公司的容器,发现真的只有我们这么设计,完全错误的方向,,,,直到老板走了之后,才开始决定重构,走上正轨。

之后有了点起色,然后开始着重强调了DevOps的重要性,期初也没人理解,还被骂天天研究技术不干活。。。这东西没技术,但是真的是公司十分需要的公司好么!!可惜公司对这个产品很失望,也不给人,期间还说要暂停项目,唉,这么大的项目就给几个人怎么做,谁都不乐意,就这么过的很憋屈吧,开始了维护的日子。。。

工作上,蛮多人对我挺好的,领导,同事,不过有时候憋屈的时候还是有了点情绪化,有时候有点悲伤的想法,浮躁、暴躁,出去面试了几次,感觉不是自己能力不好,而是市场上的真的需要3+年以上的。。。。不过感觉自己能在这里憋屈的过了这么久,也是很佩服自己的,哈哈,用同事的话来说就是:当做游戏里的练级,锻炼自己哈哈哈

学习

项目的方向错误,导致自己写的代码都是很简单的增删改查,没有技术含量的那种,也最终导致自己浪费了不少时间,上半年算是很气愤吧,不想就这么浪费掉这些时间,虽然期间看了各种各样的东西,比如Netty、Go、操作系统什么的,最终发现,如果不在项目中使用的话,真的会忘,而且很快就忘掉,最后的还是决定学习项目相关度比较大的东西了,比如Go,如果项目不是很大,小项目的话,就用Go来写,这么做感觉提升还是挺大的。
过去一年往南山图书馆借了不少书,省了不少钱,虽然没怎么看,但我至少有个奋斗的心啊,哈哈哈哈哈哈哈哈,文章写得少了,因为感觉写不出好东西,总是入门的那种,不深,不值得学习,想想到时候把别人给坑了,也不好意思。
操作系统感觉还是要好好学学了,加油

Kubernetes就是未来的方向,有时候翻开源码看看,又不敢往下面看了,对底层不熟吧,今年要多多研究下Kubernetes的源码了,至于Spring那一套,也不知道该不该放弃,或者都学习一下?云原生就是趋势。

感情

吵架了,没心思写

运动

过去一年还是把运动算是坚持了下来,每个月必去深圳湾跑一次。还是没怎么睡好,工作感情上都有点不顺,加上自己本身就难以入睡,有时候躺床上就是怎么也睡不着,还长了痘痘,要跑去医院那种,可怕,老了,还是要早点睡觉,多走走多运动,好久没打羽毛球了,自己也不想有空的时候只会打游戏,今年继续加油,多运动吧。

还爬了两次南山

其他

看了周围蛮多同事去了腾讯阿里,有点心动,好想去csig,没到3年真的让人很抓狂。
过去一年过的蛮憋屈的,特别是工作不顺,加上跟女朋友吵架,心态爆炸。。。

2020展望

每年这个时候,都不敢有太大的期望了,祝大家都健健康康的,工作顺利!!

当然,如果有可能的话,我想去CSIG

',22),h=[n];function p(c,d){return a(),i("div",null,h)}const f=e(t,[["render",p],["__file","2019.html.vue"]]);export{f as default}; diff --git a/assets/2019.html-kO5k2-yN.js b/assets/2019.html-kO5k2-yN.js new file mode 100644 index 00000000..d5452968 --- /dev/null +++ b/assets/2019.html-kO5k2-yN.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-1c10c0ce","path":"/life/2019.html","title":"","lang":"zh-CN","frontmatter":{"description":"2019,本命年,1字头开头的年份,就这么过去了,迎来了2开头的十年,12月过的不是很好,每隔几天就吵架,都没怎么想起写自己的年终总结了,对这个跨年也不是很重视,貌似有点浑浑噩噩的样子。今天1号,就继续来公司学习学习,就写写文章吧。 19年一月,没发生什么事,对老板也算是失望,打算过完春节就出去外面试试,完全的架构错误啊,怎么守得了,然后开了个年会,没什么好看的,唯一的例外就是看见漂漂亮亮的她,可惜不敢搭话,就这么的呗。2月以奇奇怪怪的方式走到了一起,开心,又有点伤心,然后就开始了这个欢喜而又悲剧的本命年。 工作 从18年底开始吧,大概就知道领导对容器云这么快的完全架构设计错误,就是一个完完全全错误的产品,其他人也觉得有点很有问题,但老板就是固执不听,结果一个跑路,一个被压得懒得反抗,然后我一个人跟老板和项目经理怼了前前后后半年,真是惨啊,还要被骂,各种拉到小黑屋里批斗,一直在对他们强调:没有这么做的!!!然后被以年轻人,不懂事,不要抱怨,长大了以后就领会了怼回来,当时气得真是无语。。。。。自己调研的阿里云、腾讯云、青云,还有其他小公司的容器,发现真的只有我们这么设计,完全错误的方向,,,,直到老板走了之后,才开始决定重构,走上正轨。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/life/2019.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"2019,本命年,1字头开头的年份,就这么过去了,迎来了2开头的十年,12月过的不是很好,每隔几天就吵架,都没怎么想起写自己的年终总结了,对这个跨年也不是很重视,貌似有点浑浑噩噩的样子。今天1号,就继续来公司学习学习,就写写文章吧。 19年一月,没发生什么事,对老板也算是失望,打算过完春节就出去外面试试,完全的架构错误啊,怎么守得了,然后开了个年会,没什么好看的,唯一的例外就是看见漂漂亮亮的她,可惜不敢搭话,就这么的呗。2月以奇奇怪怪的方式走到了一起,开心,又有点伤心,然后就开始了这个欢喜而又悲剧的本命年。 工作 从18年底开始吧,大概就知道领导对容器云这么快的完全架构设计错误,就是一个完完全全错误的产品,其他人也觉得有点很有问题,但老板就是固执不听,结果一个跑路,一个被压得懒得反抗,然后我一个人跟老板和项目经理怼了前前后后半年,真是惨啊,还要被骂,各种拉到小黑屋里批斗,一直在对他们强调:没有这么做的!!!然后被以年轻人,不懂事,不要抱怨,长大了以后就领会了怼回来,当时气得真是无语。。。。。自己调研的阿里云、腾讯云、青云,还有其他小公司的容器,发现真的只有我们这么设计,完全错误的方向,,,,直到老板走了之后,才开始决定重构,走上正轨。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"工作","slug":"工作","link":"#工作","children":[]},{"level":2,"title":"学习","slug":"学习","link":"#学习","children":[]},{"level":2,"title":"感情","slug":"感情","link":"#感情","children":[]},{"level":2,"title":"运动","slug":"运动","link":"#运动","children":[]},{"level":2,"title":"其他","slug":"其他","link":"#其他","children":[]},{"level":2,"title":"2020展望","slug":"_2020展望","link":"#_2020展望","children":[]}],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":4.43,"words":1328},"filePathRelative":"life/2019.md","localizedDate":"2024年1月24日","excerpt":"

2019,本命年,1字头开头的年份,就这么过去了,迎来了2开头的十年,12月过的不是很好,每隔几天就吵架,都没怎么想起写自己的年终总结了,对这个跨年也不是很重视,貌似有点浑浑噩噩的样子。今天1号,就继续来公司学习学习,就写写文章吧。
\\n19年一月,没发生什么事,对老板也算是失望,打算过完春节就出去外面试试,完全的架构错误啊,怎么守得了,然后开了个年会,没什么好看的,唯一的例外就是看见漂漂亮亮的她,可惜不敢搭话,就这么的呗。2月以奇奇怪怪的方式走到了一起,开心,又有点伤心,然后就开始了这个欢喜而又悲剧的本命年。

\\n

工作

\\n

从18年底开始吧,大概就知道领导对容器云这么快的完全架构设计错误,就是一个完完全全错误的产品,其他人也觉得有点很有问题,但老板就是固执不听,结果一个跑路,一个被压得懒得反抗,然后我一个人跟老板和项目经理怼了前前后后半年,真是惨啊,还要被骂,各种拉到小黑屋里批斗,一直在对他们强调:没有这么做的!!!然后被以年轻人,不懂事,不要抱怨,长大了以后就领会了怼回来,当时气得真是无语。。。。。自己调研的阿里云、腾讯云、青云,还有其他小公司的容器,发现真的只有我们这么设计,完全错误的方向,,,,直到老板走了之后,才开始决定重构,走上正轨。

","autoDesc":true}');export{e as data}; diff --git a/assets/28gfhn-5aEotGhL.png b/assets/28gfhn-5aEotGhL.png new file mode 100644 index 00000000..7394d66e Binary files /dev/null and b/assets/28gfhn-5aEotGhL.png differ diff --git "a/assets/3.\345\256\232\346\227\266\344\273\273\345\212\241.html-bKwnUW3o.js" "b/assets/3.\345\256\232\346\227\266\344\273\273\345\212\241.html-bKwnUW3o.js" new file mode 100644 index 00000000..3fcf8014 --- /dev/null +++ "b/assets/3.\345\256\232\346\227\266\344\273\273\345\212\241.html-bKwnUW3o.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-731a76b6","path":"/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html","title":"3.定时任务","lang":"zh-CN","frontmatter":{"description":"3.定时任务 先看一下Quartz的架构图: 一.特点: 强大的调度功能,例如支持丰富多样的调度方法,可以满足各种常规及特殊需求; 灵活的应用方式,例如支持任务和调度的多种组合方式,支持调度数据的多种存储方式; 分布式和集群能力。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"3.定时任务"}],["meta",{"property":"og:description","content":"3.定时任务 先看一下Quartz的架构图: 一.特点: 强大的调度功能,例如支持丰富多样的调度方法,可以满足各种常规及特殊需求; 灵活的应用方式,例如支持任务和调度的多种组合方式,支持调度数据的多种存储方式; 分布式和集群能力。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"3.定时任务\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":3,"title":"一.特点:","slug":"一-特点","link":"#一-特点","children":[]},{"level":3,"title":"二.主要组成部分","slug":"二-主要组成部分","link":"#二-主要组成部分","children":[]},{"level":3,"title":"三、Quartz设计","slug":"三、quartz设计","link":"#三、quartz设计","children":[]},{"level":3,"title":"四、使用","slug":"四、使用","link":"#四、使用","children":[]},{"level":2,"title":"Spring的高级特性之定时任务","slug":"spring的高级特性之定时任务","link":"#spring的高级特性之定时任务","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":3.54,"words":1063},"filePathRelative":"personalWebsite/3.定时任务.md","localizedDate":"2024年1月25日","excerpt":"

3.定时任务

\\n

先看一下Quartz的架构图:

\\n
\\"\\"
\\n

一.特点:

\\n
    \\n
  1. 强大的调度功能,例如支持丰富多样的调度方法,可以满足各种常规及特殊需求;
  2. \\n
  3. 灵活的应用方式,例如支持任务和调度的多种组合方式,支持调度数据的多种存储方式;
  4. \\n
  5. 分布式和集群能力。
  6. \\n
","autoDesc":true}');export{e as data}; diff --git "a/assets/3.\345\256\232\346\227\266\344\273\273\345\212\241.html-eD7hZxqJ.js" "b/assets/3.\345\256\232\346\227\266\344\273\273\345\212\241.html-eD7hZxqJ.js" new file mode 100644 index 00000000..215ca8a8 --- /dev/null +++ "b/assets/3.\345\256\232\346\227\266\344\273\273\345\212\241.html-eD7hZxqJ.js" @@ -0,0 +1,71 @@ +import{_ as p}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as l,c,a as n,d as a,b as t,e}from"./app-hbwtiwmf.js";const i={},u=e('

3.定时任务

先看一下Quartz的架构图:

一.特点:

  1. 强大的调度功能,例如支持丰富多样的调度方法,可以满足各种常规及特殊需求;
  2. 灵活的应用方式,例如支持任务和调度的多种组合方式,支持调度数据的多种存储方式;
  3. 分布式和集群能力。

二.主要组成部分

  1. JobDetail:需实现该接口定义的人物,其中JobExecutionContext提供了上下文的各种信息。
  2. JobDetail:QUartz的执行任务的类,通过newInstance的反射机制实例化Job。
  3. Trigger: Job的时间触发规则。主要有SimpleTriggerImpl和CronTriggerImpl两个实现类。
  4. Calendar:org.quartz.Calendar和java.util.Calendar不同,它是一些日历特定时间点的集合(可以简单地将org.quartz.Calendar看作java.util.Calendar的集合——java.util.Calendar代表一个日历时间点,无特殊说明后面的Calendar即指org.quartz.Calendar)。
  5. Scheduler:由上图可以看出,Scheduler是Quartz独立运行的容器。其中,Trigger和JobDetail可以注册到Scheduler中。
  6. ThreadPool:Scheduler使用一个线程池作为任务运行的基础设施,任务通过共享线程池中的线程提高运行效率。

三、Quartz设计

',8),r=n("br",null,null,-1),k={href:"http://www.quartz-scheduler.org/documentation/quartz-2.2.x/quick-start.html",target:"_blank",rel:"noopener noreferrer"},d=n("li",null,null,-1),g=e(`

四、使用

  1. hello world!代码在这
  2. 本网站中使用quartz来对数据库进行备份,与Spring结合
    (1)导入spring的拓展包,其协助spring集成第三方库:邮件服务、定时任务、缓存等。。。
<dependency>
+    <groupId>org.springframework</groupId>
+    <artifactId>spring-context-support</artifactId>
+    <version>4.2.6.RELEASE</version>
+</dependency>
+

(2)导入quartz包

<dependency>
+    <groupId>org.quartz-scheduler</groupId>
+    <artifactId>quartz</artifactId>
+    <version>2.3.0</version>
+</dependency>
+

(3)mysql远程备份
使用命令行工具仅仅需要一行:

mysqldump -u [username] -p[password] -h [hostip] database > file
+

但是java不能直接执行linux的命令,仍旧需要依赖第三方库ganymed

<dependency>
+    <groupId>ch.ethz.ganymed</groupId>
+    <artifactId>ganymed-ssh2</artifactId>
+    <version>262</version>
+</dependency>
+

完整代码如下:

@Component("mysqlService")//在spring中注册一个mysqlService的Bean
+public class MysqlUtil {
+    ...
+    StringBuffer sb = new StringBuffer();
+    sb.append("mysqldump -u " + username + " -p" + password + " -h " + host + " " +
+            database + " >" + file);
+    String sql = sb.toString();
+    Connection connection = new Connection(s_host);
+    connection.connect();
+    boolean isAuth = connection.authenticateWithPassword(s_username, s_password);//进行远程服务器登陆认证
+    if (!isAuth) {
+        logger.error("server login error");
+    }
+    Session session = connection.openSession();
+    session.execCommand(sql);//执行linux语句
+    InputStream stdout = new StreamGobbler(session.getStdout());
+    BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
+    ...
+}
+

(4)spring中配置quartz

<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
+    <property name="targetObject" ref="mysqlService"/>
+    <property name="targetMethod" value="exportDataBase"/>
+</bean>
+<!--定义触发时间  -->
+<bean id="myTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
+    <property name="jobDetail" ref="jobDetail"/>
+    <!-- cron表达式,每周五2点59分运行-->
+    <property name="cronExpression" value="0 59 2 ? * FRI"/>
+</bean>
+<!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->
+<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
+    <property name="triggers">
+        <list>
+            <ref bean="myTrigger"/>
+        </list>
+    </property>
+</bean>
+
`,13),v={href:"https://github.com/Zephery/newblog/blob/master/src/main/java/com/myblog/util/MysqlUtil.java",target:"_blank",rel:"noopener noreferrer"},m=e(`

Spring的高级特性之定时任务

java ee项目的定时任务中除了运行quartz之外,spring3+还提供了task,可以看做是一个轻量级的Quartz,而且使用起来比Quartz简单的多。

(1)spring配置文件中配置:

<task:annotation-driven/>
+

(2)最简单的例子,在所需要的函数上添加定时任务即可运行

    @Scheduled(fixedRate = 5000)
+    public void reportCurrentTime() {
+        System.out.println("每隔5秒运行一次" + sdf.format(new Date()));
+    }
+

(3)运行的时候会报错:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined
+	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:372)
+	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)
+	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.finishRegistration(ScheduledAnnotationBeanPostProcessor.java:192)
+	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:171)
+	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:86)
+	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
+	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
+	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:380)
+
`,8),b=n("br",null,null,-1),h={href:"http://blog.csdn.net/oarsman/article/details/52801877",target:"_blank",rel:"noopener noreferrer"},q=n("br",null,null,-1),f={href:"http://stackoverflow.com/questions/31199888/spring-task-scheduler-no-qualifying-bean-of-type-org-springframework-scheduli",target:"_blank",rel:"noopener noreferrer"},y=n("br",null,null,-1),_=e(`

1.尝试从配置中找到一个TaskScheduler Bean

2.寻找ScheduledExecutorService Bean

3.使用默认的scheduler
修改log4j.properties即可:
log4j.logger.org.springframework.scheduling=INFO
其实这个功能不影响定时器的功能。
(4)结果:

每隔5秒运行一次14:44:34
+每隔5秒运行一次14:44:39
+每隔5秒运行一次14:44:44
+
`,4);function w(x,S){const s=o("ExternalLinkIcon");return l(),c("div",null,[u,n("ol",null,[n("li",null,[a("properties file"),r,n("a",k,[a("官网"),t(s)]),a("中表明:quartz中使用了quartz.properties来对quartz进行配置,并保留在其jar包中,如果没有定义则默认使用改文件。")]),d]),g,n("p",null,[a("(5)java完整文件"),n("a",v,[a("在这"),t(s)])]),m,n("p",null,[a("参考:"),b,a(" 1."),n("a",h,[a("http://blog.csdn.net/oarsman/article/details/52801877"),t(s)]),q,a(" 2."),n("a",f,[a("http://stackoverflow.com/questions/31199888/spring-task-scheduler-no-qualifying-bean-of-type-org-springframework-scheduli"),t(s)]),y,a(" Spring的定时任务调度器会尝试获取一个注册过的 task scheduler来做任务调度,它会尝试通过BeanFactory.getBean的方法来获取一个注册过的scheduler bean,获取的步骤如下:")]),_])}const B=p(i,[["render",w],["__file","3.定时任务.html.vue"]]);export{B as default}; diff --git a/assets/3hnb7w-g33gFTSI.png b/assets/3hnb7w-g33gFTSI.png new file mode 100644 index 00000000..5b42e2c1 Binary files /dev/null and b/assets/3hnb7w-g33gFTSI.png differ diff --git "a/assets/4.\346\227\245\345\277\227\347\263\273\347\273\237.html-4izcXrKw.js" "b/assets/4.\346\227\245\345\277\227\347\263\273\347\273\237.html-4izcXrKw.js" new file mode 100644 index 00000000..c25f47d3 --- /dev/null +++ "b/assets/4.\346\227\245\345\277\227\347\263\273\347\273\237.html-4izcXrKw.js" @@ -0,0 +1,224 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as c,c as i,a as n,d as s,b as t,e as p}from"./app-hbwtiwmf.js";const l={},u={id:"_4-日志系统-md",tabindex:"-1"},r=n("a",{class:"header-anchor",href:"#_4-日志系统-md","aria-hidden":"true"},"#",-1),d={href:"http://4.xn--m6tr8kvwwlxb.md",target:"_blank",rel:"noopener noreferrer"},k={href:"http://www.wenzhihuai.com/",target:"_blank",rel:"noopener noreferrer"},v={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},m={href:"https://tongji.baidu.com/web/welcome/login",target:"_blank",rel:"noopener noreferrer"},b={href:"https://www.umeng.com/",target:"_blank",rel:"noopener noreferrer"},g=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/baidutongji3333.png?imageView2/2/w/300",alt:"",tabindex:"0"}),n("figcaption")],-1),h={href:"http://www.wenzhihuai.com/log.html",target:"_blank",rel:"noopener noreferrer"},_=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/20170918090524.png",alt:"",tabindex:"0"}),n("figcaption")],-1),y=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/20170918090534.png",alt:"",tabindex:"0"}),n("figcaption")],-1),q=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/20170918090546.png",alt:"",tabindex:"0"}),n("figcaption")],-1),f={href:"https://github.com/Zephery/baidutongji",target:"_blank",rel:"noopener noreferrer"},w=p(`

1.网站代码安装

先在百度统计中注册登录之后,进入管理页面,新增网站,然后在代码管理中获取安装代码,大部分人的代码都是类似的,除了hm.js?后面的参数,是记录该网站的唯一标识。

<script>
+var _hmt = _hmt || [];
+(function() {
+  var hm = document.createElement("script");
+  hm.src = "https://hm.baidu.com/hm.js?code";
+  var s = document.getElementsByTagName("script")[0];
+  s.parentNode.insertBefore(hm, s);
+})();
+</script>
+

同时,需要在申请其他设置->数据导出服务中开通数据导出服务,百度统计Tongji API可以为网站接入者提供便捷的获取网站流量数据的通道。

至此,我们获得了username、password、token,然后开始使用三个参数来获取数据。

2.根据API获取数据

`,7),x={href:"https://tongji.baidu.com/dataapi/file/TongjiApiFile.pdf",target:"_blank",rel:"noopener noreferrer"},j=n("br",null,null,-1),I={href:"https://api.baidu.com/json/tongji/v1/ReportService/getData",target:"_blank",rel:"noopener noreferrer"},z={href:"https://tongji.baidu.com/dataapi/file/TongjiApiFile.pdf",title:"百度统计",target:"_blank",rel:"noopener noreferrer"},T=n("br",null,null,-1),A=p(`
参数名称参数类型描述
methodstring要查询的报告
start_datestring查询起始时间
end_datestring查询结束时间
metricsstring自定义指标

其中,参数start_date和end_date的规定为:yyyyMMdd,这里我们使用python的原生库,datetime、time,获取昨天的时间以及前七天的日期。

today = datetime.date.today()   # 获取今天的日期
+yesterday = today - datetime.timedelta(days=1) # 获取昨天的日期
+fifteenago = today - datetime.timedelta(days=7) # 获取前七天的日期
+end, start = str(yesterday).replace("-", ""), str(fifteenago).replace("-", "")  # 格式化成yyyyMMdd格式
+

3.构建请求

说明:siteId可以根据个人百度统计的链接获取,也可以使用Tongji API的第一个接口列表获取用户的站点列表。首先,我们构建一个类,由于username、password、token都是通用的,所以我们将它设置为构造方法的参数。

class Baidu(object):
+    def __init__(self, siteId, username, password, token):
+        self.siteId = siteId
+        self.username = username
+        self.password = password
+        self.token = token
+

然后构建一个共同的方法,用来获取提交数据之后返回的结果,其中提供了4个可变参数,分别是(start_date:起始日期,end_date:结束日期,method:方法,metrics:指标),返回的是字节,最后需要decode("utf-8")一下变成字符:

def getresult(self, start_date, end_date, method, metrics):
+    body = {"header": {"account_type": 1, "password": self.password, "token": self.token,
+                       "username": self.username},
+            "body": {"siteId": self.siteId, "method": method, "start_date": start_date,
+                     "end_date": end_date,
+                     "metrics": metrics}}
+    data = bytes(json.dumps(body), 'utf8')
+    req = urllib.request.Request(base_url, data)
+    response = urllib.request.urlopen(req)
+    the_page = response.read()
+    return the_page.decode("utf-8")
+
`,8),P={href:"https://github.com/Zephery/baidutongji/blob/master/baidu.py",target:"_blank",rel:"noopener noreferrer"},Z=n("h2",{id:"_4-实际运用",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#_4-实际运用","aria-hidden":"true"},"#"),s(" 4.实际运用")],-1),E=n("p",null,"(1)需要使用其他参数怎么办",-1),V=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/20170919091911.png",alt:"",tabindex:"0"}),n("figcaption")],-1),R={href:"http://www.jianshu.com/p/98f7e34845b5",target:"_blank",rel:"noopener noreferrer"},B=p(`
def getresult(self, start_date, end_date, method, metrics, **kw):
+    base_url = "https://api.baidu.com/json/tongji/v1/ReportService/getData"
+    body = {"header": {"account_type": 1, "password": self.password, "token": self.token,
+                       "username": self.username},
+            "body": {"siteId": self.siteId, "method": method, "start_date": start_date,
+                     "end_date": end_date, "metrics": metrics}}
+    for key in kw:  #对可变参数进行遍历,如果有的话就往body中加入
+        body['body'][key] = kw[key]
+

使用方式:

result = self.getresult(start, end, "source/all/a",
+                        "pv_count,visitor_count,avg_visit_time", viewType='visitor')  #其中viewTYpe便是可变参数
+

(2)获取的数据如何解析
百度统计返回的结果比较简洁而又反人类,以获取概览中的pv_count,visitor_count,ip_count,bounce_ratio,avg_visit_time为例子:

result = bd.getresult(start, end, "overview/getTimeTrendRpt",
+                      "pv_count,visitor_count,ip_count,bounce_ratio,avg_visit_time")
+

返回的结果是:

[[['2017/09/12'], ['2017/09/13'], ['2017/09/14'], ['2017/09/15'], ['2017/09/16'], ['2017/09/17'], ['2017/09/18']],   
+[[422, 76, 76, 41.94, 221],  
+ [284, 67, 65, 50.63, 215],   
+ [67, 23, 22, 52.17, 153],   
+ [104, 13, 13, 36.36, 243],   
+ [13, 4, 4, 33.33, 66],   
+ [73, 7, 6, 37.5, 652],  
+ [63, 11, 11, 33.33, 385]  
+ ], [], []]
+

即:翻译成人话就是:

[[[date1,date2,...]], 
+ [[date1的pv_count, date1的visitor_count, date1的ip_count, date1的bounce_ratio, date1的avg_visit_time],
+ [date2的pv_count, date2的visitor_count, date2的ip_count, date2的bounce_ratio, date2的avg_visit_time],
+  ...,[]
+ ],[],[]]
+

极其反人类的设计。还好用的python,python数组的特性实在太强了。出了可以运用[x for x in range]这类语法之外,还能与三元符(x if y else x+1,如果y成立,那么结果是x,如果y不成立,那么结果是x+1)一起使用,这里注意:如果当天访问量为0,其返回的json结果是'--',所以要判断是不是为'--',归0化,才能在折线图等各种图上显示。下面是pv_count的例子:

pv_count = [x[0] if x[0] != '--' else 0 for x in result[1]]
+

(3)每周限制2000次
在开通数据导出服务的时候,不知道大家有没有注意到它的说明,即我们是不能实时监控的,只能将它放在临时数据库中,这里我们选择了Redis,并在centos里定义一个定时任务,每天全部更新一次即可。

python中redis的使用方法很简单,连接跟mysql类似:

# 字符串
+pool = redis.ConnectionPool(host='your host ip', port=port, password='your auth')  # TODO redis地址
+r = redis.Redis(connection_pool=pool)
+

本网站使用redis的数据结构只有set,方法也很简单,就是定义一个key,然后value是数组的字符串获取json。

ip_count = [x[2] if x[2] != '--' else 0 for x in result[1]]
+r.set("ip_count", ip_count)
+# json
+name = [item[0]['name'] for item in data[0]]
+count = 0
+tojson = []
+for item in data[1]:
+    temp = {}
+    temp["name"] = name[count]
+    temp["pv_count"] = item[0]
+    temp["visitor_count"] = item[1]
+    temp["average_stay_time"] = item[2]
+    tojson.append(temp)
+    count = count + 1
+r.set("rukouyemian", json.dumps(tojson[:5]))
+

5.基本代码

`,18),S={href:"https://github.com/Zephery/baidutongji/blob/master/demo.py",target:"_blank",rel:"noopener noreferrer"},L=p(`
import json
+import time
+import datetime
+import urllib.parse
+import urllib.request
+
+base_url = "https://api.baidu.com/json/tongji/v1/ReportService/getData"
+
+class Baidu(object):
+    def __init__(self, siteId, username, password, token):
+        self.siteId = siteId
+        self.username = username
+        self.password = password
+        self.token = token
+
+    def getresult(self, start_date, end_date, method, metrics, **kw):
+        base_url = "https://api.baidu.com/json/tongji/v1/ReportService/getData"
+        body = {"header": {"account_type": 1, "password": self.password, "token": self.token,
+                           "username": self.username},
+                "body": {"siteId": self.siteId, "method": method, "start_date": start_date,
+                         "end_date": end_date, "metrics": metrics}}
+        for key in kw:
+            body['body'][key] = kw[key]
+        data = bytes(json.dumps(body), 'utf8')
+        req = urllib.request.Request(base_url, data)
+        response = urllib.request.urlopen(req)
+        the_page = response.read()
+        return the_page.decode("utf-8")
+
+if __name__ == '__main__':
+    # 日期开始
+    today = datetime.date.today()
+    yesterday = today - datetime.timedelta(days=1)
+    fifteenago = today - datetime.timedelta(days=7)
+    end, start = str(yesterday).replace("-", ""), str(fifteenago).replace("-", "")
+    # 日期结束
+    bd = Baidu(yoursiteid, "username", "password", "token")
+    result = bd.getresult(start, end, "overview/getTimeTrendRpt",
+                          "pv_count,visitor_count,ip_count,bounce_ratio,avg_visit_time")
+    result = json.loads(result)
+    base = result["body"]["data"][0]["result"]["items"]
+    print(base)
+
+

6.展示数据

`,2),$={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},D=n("br",null,null,-1),N=n("br",null,null,-1),O=p(`
String pv_count = jedis.get("pv_count");
+String visitor_count = jedis.get("visitor_count");
+mv.addObject("pv_count", pv_count);
+mv.addObject("visitor_count", visitor_count);
+

jsp中的使用如下:

<div class="panel-heading" style="background-color: rgba(187,255,255,0.7)">
+    <div class="card-title">
+        <strong>PV和UV折线图</strong>
+    
+    
+    <div class="panel-body">
+        <div id="linecontainer" style="width: auto;height: 330px">
+        <script>
+            var chart = new Highcharts.Chart('linecontainer', {
+                title: {
+                    text: null
+                },
+                credits: {
+                    enabled: false
+                },
+                xAxis: {
+                    categories: ${daterange}
+                },
+                yAxis: {
+                    title: {
+                        text: '次数'
+                    },
+                    plotLines: [{
+                        value: 0,
+                        width: 1,
+                        color: '#808080'
+                    }]
+                },
+                tooltip: {
+                    valueSuffix: '次'
+                },
+                legend: {
+                    borderWidth: 0,
+                    align: "center", //程度标的目标地位
+                    verticalAlign: "top", //垂直标的目标地位
+                    x: 0, //间隔x轴的间隔
+                    y: 0 //间隔Y轴的间隔
+                },
+                series: [{
+                    name: 'pv',
+                    data:${pv_count}
+                }, {
+                    name: 'uv',
+                    data:${visitor_count}
+                }]
+            })
+        </script>
+

效果如下:

(2)地域访问量
在python代码中先获取地域的数据,其结果如下,百度统计跟echarts都是百度的,果然,自家人对自己人的支持真是特别友好的。

[{'pv_count': 649, 'pv_ratio': 7, 'visitor_count': 2684, 'name': '广东'}, {'pv_count': 2, 'pv_ratio': 2, 'visitor_count': 76, 'name': '四川'}, {'pv_count': 1, 'pv_ratio': 1, 'visitor_count': 3, 'name': '江苏'}]
+
`,7),C=n("strong",null,"地域图",-1),G={href:"http://echarts.baidu.com/download-map.html",target:"_blank",rel:"noopener noreferrer"},H={href:"http://echarts.baidu.com/download.html",target:"_blank",rel:"noopener noreferrer"},M=n("br",null,null,-1),K=p(`
<script type="text/javascript">
+    var myChart = echarts.init(document.getElementById('diyu'));
+    option = {
+        tooltip: {
+            trigger: 'item'
+        },
+        legend: {
+            orient: 'vertical',
+            left: 'left'
+        },
+        visualMap: {
+            min: 0,
+            max:\${diyumax},
+            left: 'left',
+            top: 'bottom',
+            text: ['高', '低'],           // 文本,默认为数值文本
+            calculable: true
+        },
+        toolbox: {
+            show: true,
+            orient: 'vertical',
+            left: 'right',
+            top: 'center',
+            feature: {
+                dataView: {readOnly: false},
+                restore: {},
+                saveAsImage: {}
+            }
+        },
+        series: [
+            {
+                name: '访问量',
+                type: 'map',
+                mapType: 'china',
+                roam: false,
+                label: {
+                    normal: {
+                        show: true
+                    },
+                    emphasis: {
+                        show: true
+                    }
+                },
+                data: [
+                    <c:forEach var="diyu" items="\${diyu}">
+                    {name: '\${diyu.name}', value: \${to.pv_count}},
+                    </c:forEach>
+                ]
+            }
+        ]
+    };
+    myChart.setOption(option);
+</script>
+

结果如下:

结语

`,3),U=n("br",null,null,-1),F={href:"http://www.wenzhihuai.com/log.html",target:"_blank",rel:"noopener noreferrer"},Y=n("br",null,null,-1),J={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},W=n("br",null,null,-1),Q={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},X=n("br",null,null,-1),nn={href:"https://github.com/Zephery/baidutongji",target:"_blank",rel:"noopener noreferrer"},sn=n("br",null,null,-1);function an(tn,pn){const a=o("ExternalLinkIcon");return c(),i("div",null,[n("h1",u,[r,s(),n("a",d,[s("4.日志系统.md"),t(a)])]),n("p",null,[s("欢迎访问我的网站"),n("a",k,[s("http://www.wenzhihuai.com/"),t(a)]),s(" 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址"),n("a",v,[s("https://github.com/Zephery/newblog"),t(a)]),s(" 。")]),n("p",null,[s("建立网站少不了日志系统,用来查看网站的访问次数、停留时间、抓取量、目录抓取统计、页面抓取统计等,其中,最常用的方法还是使用ELK,但是,本网站的服务器配置实在太低了(1GHZ、2G内存),压根就跑不起ELK,所以只能寻求其他方式,目前最常用的有"),n("a",m,[s("百度统计"),t(a)]),s("和"),n("a",b,[s("友盟"),t(a)]),s(",这里,本人使用的是百度统计,提供了API给开发者使用,能够将自己所需要的图表移植到自己的网站上。日志是网站及其重要的文件,通过对日志进行统计、分析、综合,就能有效地掌握网站运行状况,发现和排除错误原因,了解客户访问分布等,更好的加强系统的维护和管理。下面是我的百度统计的概览页面:")]),g,n("p",null,[s("企业级的网站日志不能公开,但是我的是个人网站,用来跟大家一起学习的,所以,需要将百度的统计页面展示出来,但是,百度并不提供日志的图像,只提供API给开发者调用,而且还限制访问次数,一天不能超过2000次,这个对于实时统计来说,确实不够,所以只能展示前几天的访问统计。这里的日志系统分为三个步骤:1.API获取数据;2.存储数据;3.展示数据。页面效果如下,也可以点开我的网站的"),n("a",h,[s("日志系统"),t(a)]),s(":")]),_,y,q,n("p",null,[s("百度统计提供了Tongji API的Java和Python版本,这两个版本及其复杂,可用性极低,所以,本人用Python写了个及其简单的通用版本,整体只有28行,代码在这,"),n("a",f,[s("https://github.com/Zephery/baidutongji"),t(a)]),s("。下面是具体过程")]),w,n("p",null,[n("a",x,[s("官网的API"),t(a)]),s("详细的记录了接口的参数以及解释,"),j,s(" 链接:"),n("a",I,[s("https://api.baidu.com/json/tongji/v1/ReportService/getData"),t(a)]),s(",详细的官方报告请访问官网"),n("a",z,[s("TongjiApi"),t(a)]),T,s(" 所需参数(必须):")]),A,n("p",null,[s("至此,python获取百度统计的过程基本就没了,没错,就是那么简简单单的几行,完整代码见"),n("a",P,[s("https://github.com/Zephery/baidutongji/blob/master/baidu.py"),t(a)]),s(",但是,想要实现获取各种数据,仍需要做很多工作。")]),Z,E,V,n("p",null,[s("python中提供了个可变参数来解决这一烦恼,详细请看"),n("a",R,[s("http://www.jianshu.com/p/98f7e34845b5"),t(a)]),s(",可变参数允许你传入0个或任意个参数,这些可变参数在函数调用时自动组装为一个tuple,而关键字参数允许你传入0个或任意个含参数名的参数,这些关键字参数在函数内部自动组装为一个dict。")]),B,n("p",null,[s("下面是基本的使用代码,完整的使用代码就不贴了,有兴趣可以去我的github上看看,"),n("a",S,[s("完整代码"),t(a)]),s(",希望能给个star哈哈哈,感谢")]),L,n("p",null,[s("在将数据存进redis中之后,我们需要在博客中使用这些数据来制作图表。在"),n("a",$,[s("newblog"),t(a)]),s("中使用方式也很简单,大概就是使用jedis读取数据,然后使用echarts或者highcharts展示。其中折线图以及线型图我都使用了highcharts,确实比echarts好看的多,但是地域图还是选择了echarts,毕竟中国的产品还是对中国的支持较好。"),D,s(" (1)PV、UV折线图"),N,s(" 以图表PV、UV为例,由于存储进redis的是一个数组,所以,可以直接从redis中读取然后放到一个attribute里即可:")]),O,n("p",null,[s("地域图目前支持最好的还是百度的echarts,使用方法见echarts的官网吧,这里不再阐述,展示"),C,s("的时候需要获取下载两个文件,"),n("a",G,[s("china.js"),t(a)]),s("(其提供了js和json,这里使用的js),"),n("a",H,[s("echarts.js"),t(a)]),s("。"),M,s(" 部分代码:")]),K,n("p",null,[s("网上关于日志系统的几乎都是ELK,对于小网站的,隐私不是很重要的还是可以用用百度统计的,这套系统也折磨了我挺久的,特别是它那反人类的返回数据。期初本来是想使用百度统计的,后来考虑了一下ELK,尝试之后发现,服务器配置跑不起来,还是安安稳稳的使用了百度统计,于此做成了这个系统,美观度还是不高,颜色需要优化一下。最后,希望能在GitHub上给我个star吧。"),U,s(" 日志系统地址:"),n("a",F,[s("http://www.wenzhihuai.com/log.html"),t(a)]),Y,s(" 个人网站网址:"),n("a",J,[s("http://www.wenzhihuai.com"),t(a)]),W,s(" 个人网站代码地址:"),n("a",Q,[s("https://github.com/Zephery/newblog"),t(a)]),X,s(" 百度统计python代码地址:"),n("a",nn,[s("https://github.com/Zephery/baidutongji"),t(a)]),sn,s(" 万分感谢")])])}const cn=e(l,[["render",an],["__file","4.日志系统.html.vue"]]);export{cn as default}; diff --git "a/assets/4.\346\227\245\345\277\227\347\263\273\347\273\237.html-NM05U0dI.js" "b/assets/4.\346\227\245\345\277\227\347\263\273\347\273\237.html-NM05U0dI.js" new file mode 100644 index 00000000..47942caf --- /dev/null +++ "b/assets/4.\346\227\245\345\277\227\347\263\273\347\273\237.html-NM05U0dI.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-bea2ce1e","path":"/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html","title":"4.日志系统.md","lang":"zh-CN","frontmatter":{"description":"4.日志系统.md 欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog 。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"4.日志系统.md"}],["meta",{"property":"og:description","content":"4.日志系统.md 欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog 。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"4.日志系统.md\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"1.网站代码安装","slug":"_1-网站代码安装","link":"#_1-网站代码安装","children":[]},{"level":2,"title":"2.根据API获取数据","slug":"_2-根据api获取数据","link":"#_2-根据api获取数据","children":[]},{"level":2,"title":"3.构建请求","slug":"_3-构建请求","link":"#_3-构建请求","children":[]},{"level":2,"title":"4.实际运用","slug":"_4-实际运用","link":"#_4-实际运用","children":[]},{"level":2,"title":"5.基本代码","slug":"_5-基本代码","link":"#_5-基本代码","children":[]},{"level":2,"title":"6.展示数据","slug":"_6-展示数据","link":"#_6-展示数据","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":9.61,"words":2883},"filePathRelative":"personalWebsite/4.日志系统.md","localizedDate":"2024年1月25日","excerpt":"

4.日志系统.md

\\n

欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog

","autoDesc":true}');export{e as data}; diff --git a/assets/404.html-EORHuK9s.js b/assets/404.html-EORHuK9s.js new file mode 100644 index 00000000..9d8ff8d6 --- /dev/null +++ b/assets/404.html-EORHuK9s.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(_,n){return t(),c("div")}const f=e(o,[["render",r],["__file","404.html.vue"]]);export{f as default}; diff --git a/assets/404.html-WhIsgby4.js b/assets/404.html-WhIsgby4.js new file mode 100644 index 00000000..ffb11d95 --- /dev/null +++ b/assets/404.html-WhIsgby4.js @@ -0,0 +1 @@ +const t=JSON.parse('{"key":"v-3706649a","path":"/404.html","title":"","lang":"zh-CN","frontmatter":{"layout":"NotFound","description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/404.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":0},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{t as data}; diff --git a/assets/4hod0s-E_0zvkjv.png b/assets/4hod0s-E_0zvkjv.png new file mode 100644 index 00000000..4980db02 Binary files /dev/null and b/assets/4hod0s-E_0zvkjv.png differ diff --git a/assets/4yrkq1-e0bbXi2X.png b/assets/4yrkq1-e0bbXi2X.png new file mode 100644 index 00000000..b1e6f168 Binary files /dev/null and b/assets/4yrkq1-e0bbXi2X.png differ diff --git "a/assets/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html-BPCQb_fL.js" "b/assets/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html-BPCQb_fL.js" new file mode 100644 index 00000000..e1acb97c --- /dev/null +++ "b/assets/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html-BPCQb_fL.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-3efc517e","path":"/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html","title":"5.小集群部署.md","lang":"zh-CN","frontmatter":{"description":"5.小集群部署.md 欢迎访问我的个人网站O(∩_∩)O哈哈~希望大佬们能给个star,个人网站网址:http://www.wenzhihuai.com,个人网站代码地址:https://github.com/Zephery/newblog。 洋洋洒洒的买了两个服务器,用来学习分布式、集群之类的东西,整来整去,感觉分布式这种东西没人指导一下真的是太抽象了,先从网站的分布式部署一步一步学起来吧,虽然网站本身的访问量不大==。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"5.小集群部署.md"}],["meta",{"property":"og:description","content":"5.小集群部署.md 欢迎访问我的个人网站O(∩_∩)O哈哈~希望大佬们能给个star,个人网站网址:http://www.wenzhihuai.com,个人网站代码地址:https://github.com/Zephery/newblog。 洋洋洒洒的买了两个服务器,用来学习分布式、集群之类的东西,整来整去,感觉分布式这种东西没人指导一下真的是太抽象了,先从网站的分布式部署一步一步学起来吧,虽然网站本身的访问量不大==。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"5.小集群部署.md\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"1.1 Nginx的安装","slug":"_1-1-nginx的安装","link":"#_1-1-nginx的安装","children":[]},{"level":2,"title":"1.2 Nginx的配置","slug":"_1-2-nginx的配置","link":"#_1-2-nginx的配置","children":[]},{"level":2,"title":"测试:","slug":"测试","link":"#测试","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":9.47,"words":2840},"filePathRelative":"personalWebsite/5.小集群部署.md","localizedDate":"2024年1月25日","excerpt":"

5.小集群部署.md

\\n

欢迎访问我的个人网站O(∩_∩)O哈哈~希望大佬们能给个star,个人网站网址:http://www.wenzhihuai.com,个人网站代码地址:https://github.com/Zephery/newblog
\\n洋洋洒洒的买了两个服务器,用来学习分布式、集群之类的东西,整来整去,感觉分布式这种东西没人指导一下真的是太抽象了,先从网站的分布式部署一步一步学起来吧,虽然网站本身的访问量不大==。

","autoDesc":true}');export{e as data}; diff --git "a/assets/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html-giTxitnr.js" "b/assets/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html-giTxitnr.js" new file mode 100644 index 00000000..8febf78b --- /dev/null +++ "b/assets/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html-giTxitnr.js" @@ -0,0 +1,105 @@ +import{_ as l}from"./plugin-vue_export-helper-x3n3nnut.js";import{r,o,c as i,a,d as n,b as s,e}from"./app-hbwtiwmf.js";const p={},c={id:"_5-小集群部署-md",tabindex:"-1"},m=a("a",{class:"header-anchor",href:"#_5-小集群部署-md","aria-hidden":"true"},"#",-1),u={href:"http://5.xn--yet863fjea402eswg.md",target:"_blank",rel:"noopener noreferrer"},d={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},Q={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},g=a("br",null,null,-1),T=a("h1",{id:"nginx负载均衡",tabindex:"-1"},[a("a",{class:"header-anchor",href:"#nginx负载均衡","aria-hidden":"true"},"#"),n(" nginx负载均衡")],-1),h=a("br",null,null,-1),f={href:"http://jinnianshilongnian.iteye.com/",target:"_blank",rel:"noopener noreferrer"},v=a("figure",null,[a("img",{src:"http://image.wenzhihuai.com/images/20171018044732.png",alt:"",tabindex:"0"}),a("figcaption")],-1),k=a("p",null,"本站并没有那么多的服务器,目前只有两台,搭建不了那么大型的架构,就简陋的用两台服务器来模拟一下负载均衡的搭建。下图是本站的简单架构:",-1),x=a("figure",null,[a("img",{src:"http://image.wenzhihuai.com/images/20171018051437.png",alt:"",tabindex:"0"}),a("figcaption")],-1),_=a("p",null,"其中服务器A(119.23.46.71)为深圳节点,服务器B(47.95.10.139)为北京节点,搭建Nginx之后流量是这么走的:user->A->B-A->user或者user->A->user,第一条中A将请求转发给B,然后B返回的是其运行结果的静态资源。因为这里仅仅是用来学习,所以请不要考虑因为地域导致延时的问题。。。。下面是过程。",-1),b=a("h2",{id:"_1-1-nginx的安装",tabindex:"-1"},[a("a",{class:"header-anchor",href:"#_1-1-nginx的安装","aria-hidden":"true"},"#"),n(" 1.1 Nginx的安装")],-1),q={href:"https://pkgs.org/download/nginx",target:"_blank",rel:"noopener noreferrer"},w=e(`

启动后页面如下:

记一下常用命令

启动nginx,由于是采用rpm方式,所以环境变量什么的都配置好了。
+[root@beijingali ~]# nginx          #启动nginx
+[root@beijingali ~]# nginx -s reload         #重启nginx
+[root@beijingali ~]# nginx -t           #校验nginx配置文件
+nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
+nginx: configuration file /etc/nginx/nginx.conf test is successful
+

1.2 Nginx的配置

1.2.1 负载均衡算法

`,7),y=a("br",null,null,-1),H=a("br",null,null,-1),L=a("br",null,null,-1),z=a("br",null,null,-1),M={href:"http://blog.csdn.net/qh_java/article/details/45955923",target:"_blank",rel:"noopener noreferrer"},D=e(`
http{
+    ...
+    upstream backend {
+        hash $uri;
+        # 北京节点
+        server 47.95.10.139:8080;
+        # 深圳节点
+        server 119.23.46.71:8080;
+    }
+
+    server {
+        ...
+        location / {
+            root   html;
+            index  index.html index.htm;
+            proxy_pass http://backend;
+            ...
+        }
+    ...
+

1.2.2 日志格式

之前有使用过ELK来跟踪日志,所以将日志格式化成了json的格式,这里贴一下吧

    ...
+    log_format main '{"@timestamp":"$time_iso8601",'
+                    '"host":"$server_addr",'
+                    '"clientip":"$remote_addr",'
+                    '"size":$body_bytes_sent,'
+                    '"responsetime":$request_time,'
+                    '"upstreamtime":"$upstream_response_time",'
+                    '"upstreamhost":"$upstream_addr",'
+                    '"http_host":"$host",'
+                    '"url":"$uri",'
+                    '"xff":"$http_x_forwarded_for",'
+                    '"referer":"$http_referer",'
+                    '"agent":"$http_user_agent",'
+                    '"status":"$status"}';
+    access_log  logs/access.log  main;
+    ...
+

1.2.3 HTTP反向代理

`,5),Z={href:"http://wwww.wenzhihuai.xn--com-5s0em31hr0u",target:"_blank",rel:"noopener noreferrer"},S={href:"http://119.23.46.71:8080",target:"_blank",rel:"noopener noreferrer"},j={href:"http://blog.csdn.net/bao19901210/article/details/52537279",target:"_blank",rel:"noopener noreferrer"},$={class:"MathJax",jax:"SVG",style:{position:"relative"}},F={style:{"vertical-align":"-0.464ex"},xmlns:"http://www.w3.org/2000/svg",width:"109.704ex",height:"2.161ex",role:"img",focusable:"false",viewBox:"0 -750 48489.1 955","aria-hidden":"true"},C=e('使',1),E=[C],I=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"r"),a("mi",null,"e"),a("mi",null,"m"),a("mi",null,"o"),a("mi",null,"t"),a("msub",null,[a("mi",null,"e"),a("mi",null,"a")]),a("mi",null,"d"),a("mi",null,"d"),a("mi",null,"r"),a("mi",{mathvariant:"normal"},"变"),a("mi",{mathvariant:"normal"},"量"),a("mi",{mathvariant:"normal"},"拿"),a("mi",{mathvariant:"normal"},"到"),a("mi",{mathvariant:"normal"},"的"),a("mi",{mathvariant:"normal"},"将"),a("mi",{mathvariant:"normal"},"是"),a("mi",{mathvariant:"normal"},"反"),a("mi",{mathvariant:"normal"},"向"),a("mi",{mathvariant:"normal"},"代"),a("mi",{mathvariant:"normal"},"理"),a("mi",{mathvariant:"normal"},"服"),a("mi",{mathvariant:"normal"},"务"),a("mi",{mathvariant:"normal"},"器"),a("mi",{mathvariant:"normal"},"的"),a("mi",null,"i"),a("mi",null,"p"),a("mi",{mathvariant:"normal"},"地"),a("mi",{mathvariant:"normal"},"址"),a("mo",{"data-mjx-pseudoscript":"true"},"”"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mo",null,"。")]),a("mi",null,"n"),a("mi",null,"g"),a("mi",null,"i"),a("mi",null,"n"),a("mi",null,"x"),a("mi",{mathvariant:"normal"},"是"),a("mi",{mathvariant:"normal"},"可"),a("mi",{mathvariant:"normal"},"以"),a("mi",{mathvariant:"normal"},"获"),a("mi",{mathvariant:"normal"},"得"),a("mi",{mathvariant:"normal"},"用"),a("mi",{mathvariant:"normal"},"户"),a("mi",{mathvariant:"normal"},"的"),a("mi",{mathvariant:"normal"},"真"),a("mi",{mathvariant:"normal"},"实"),a("mi",null,"i"),a("mi",null,"p"),a("mi",{mathvariant:"normal"},"的"),a("mi",null,","),a("mi",{mathvariant:"normal"},"也"),a("mi",{mathvariant:"normal"},"就"),a("mi",{mathvariant:"normal"},"是"),a("mi",{mathvariant:"normal"},"说"),a("mi",null,"n"),a("mi",null,"g"),a("mi",null,"i"),a("mi",null,"n"),a("mi",null,"x"),a("mi",{mathvariant:"normal"},"使"),a("mi",{mathvariant:"normal"},"用")])],-1),P=e(`
        location / {
+            root   html;
+            index  index.html index.htm;
+            proxy_pass http://backend;
+            proxy_set_header X-Real-IP $remote_addr;
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_set_header Host $host;
+            proxy_set_header REMOTE-HOST $remote_addr;
+        }
+

(1)proxy_set_header X-real-ip $remote_addr;
其中这个X-real-ip是一个自定义的变量名,名字可以随意取,这样做完之后,用户的真实ip就被放在X-real-ip这个变量里了,然后,在web端可以这样获取:
request.getAttribute("X-real-ip")

(2)proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

`,3),R={class:"MathJax",jax:"SVG",style:{position:"relative"}},B={style:{"vertical-align":"-0.452ex"},xmlns:"http://www.w3.org/2000/svg",width:"49.321ex",height:"2.149ex",role:"img",focusable:"false",viewBox:"0 -750 21800 950","aria-hidden":"true"},A=a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"merror","data-mjx-error":"Double subscripts: use braces to clarify",title:"Double subscripts: use braces to clarify"},[a("rect",{"data-background":"true",width:"21800",height:"950",y:"-200"}),a("title",null,"Double subscripts: use braces to clarify"),a("g",{"data-mml-node":"mtext",style:{"font-family":"serif"}},[a("text",{"data-variant":"-explicitFont",transform:"scale(1,-1)","font-size":"884px"},"proxy_add_x_forwarded_for一起使用。 ")])])])],-1),N=[A],X=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("merror",{"data-mjx-error":"Double subscripts: use braces to clarify",title:"Double subscripts: use braces to clarify"},[a("mtext",null,"proxy_add_x_forwarded_for一起使用。 ")])])],-1),V={class:"MathJax",jax:"SVG",style:{position:"relative"}},O={style:{"vertical-align":"-0.452ex"},xmlns:"http://www.w3.org/2000/svg",width:"90.95ex",height:"2.149ex",role:"img",focusable:"false",viewBox:"0 -750 40200 950","aria-hidden":"true"},G=a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"merror","data-mjx-error":"Double subscripts: use braces to clarify",title:"Double subscripts: use braces to clarify"},[a("rect",{"data-background":"true",width:"40200",height:"950",y:"-200"}),a("title",null,"Double subscripts: use braces to clarify"),a("g",{"data-mml-node":"mtext",style:{"font-family":"serif"}},[a("text",{"data-variant":"-explicitFont",transform:"scale(1,-1)","font-size":"884px"},"proxy_add_x_forwarded_for变量,X-Forwarded-For部分包含的是用户的真实ip,")])])])],-1),J=[G],U=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("merror",{"data-mjx-error":"Double subscripts: use braces to clarify",title:"Double subscripts: use braces to clarify"},[a("mtext",null,"proxy_add_x_forwarded_for变量,X-Forwarded-For部分包含的是用户的真实ip,")])])],-1),K=a("h4",{id:"_1-2-4-https",tabindex:"-1"},[a("a",{class:"header-anchor",href:"#_1-2-4-https","aria-hidden":"true"},"#"),n(),a("strong",null,"1.2.4 HTTPS")],-1),W={href:"https://baike.baidu.com/item/https/285356?fr=aladdin",target:"_blank",rel:"noopener noreferrer"},Y=e(`

首先需要下载证书,放在nginx.conf相同目录下,nginx上的配置也需要有所改变,在nginx.conf中设置listen 443 ssl;开启https。然后配置证书和私钥:

        ssl_certificate 1_www.wenzhihuai.com_bundle.crt;    #主要文件路径
+        ssl_certificate_key 2_www.wenzhihuai.com.key;
+        ssl_session_timeout 5m;         # 超时时间
+        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
+        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
+        ssl_prefer_server_ciphers on;
+

至此,可以使用https来访问了。https带来的安全性(保证信息安全、识别钓鱼网站等)是http远远不能比拟的,目前大部分网站都是实现全站https,还能将http自动重定向为https,此处,需要在server中添加rewrite ^(.*) https://$server_name$1 permanent;即可

1.2.5 失败重试

配置好了负载均衡之后,如果有一台服务器挂了怎么办?nginx中提供了可配置的服务器存活的识别,主要是通过max_fails失败请求次数,fail_timeout超时时间,weight为权重,下面的配置的意思是当服务器超时10秒,并失败了两次的时候,nginx将认为上游服务器不可用,将会摘掉上游服务器,fail_timeout时间后会再次将该服务器加入到存活上游服务器列表进行重试

upstream backend_server {
+    server 10.23.46.71:8080 max_fails=2 fail_timeout=10s weight=1;
+    server 47.95.10.139:8080 max_fails=2 fail_timeout=10s weight=1;
+}
+

session共享

`,8),aa={href:"http://blog.csdn.net/qh_java/article/details/45955923",target:"_blank",rel:"noopener noreferrer"},na=a("br",null,null,-1),ta=a("br",null,null,-1),sa=a("br",null,null,-1),ea=a("br",null,null,-1),oa={href:"https://docs.spring.io/spring-session/docs/2.0.0.BUILD-SNAPSHOT/reference/html5/",target:"_blank",rel:"noopener noreferrer"},ia=e(`

首先,添加相关依赖

        <dependency>
+            <groupId>org.springframework.session</groupId>
+            <artifactId>spring-session-data-redis</artifactId>
+            <version>1.3.1.RELEASE</version>
+            <type>pom</type>
+        </dependency>
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+            <version>\${jedis.version}</version>
+        </dependency>
+

新建一个session.xml,然后在spring的配置文件中添加该文件,然后在session.xml中添加:

    <!-- redis -->
+    <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
+    </bean>
+
+    <bean id="jedisConnectionFactory"
+          class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
+        <property name="hostName" value="\${host}" />
+        <property name="port" value="\${port}" />
+        <property name="password" value="\${password}" />
+        <property name="timeout" value="\${timeout}" />
+        <property name="poolConfig" ref="jedisPoolConfig" />
+        <property name="usePool" value="true" />
+    </bean>
+
+    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
+        <property name="connectionFactory" ref="jedisConnectionFactory" />
+    </bean>
+
+    <!-- 将session放入redis -->
+    <bean id="redisHttpSessionConfiguration"
+          class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration">
+        <property name="maxInactiveIntervalInSeconds" value="1800" />
+    </bean>
+

然后我们需要保证servlet容器(tomcat)针对每一个请求都使用springSessionRepositoryFilter来拦截

<filter>
+    <filter-name>springSessionRepositoryFilter</filter-name>
+    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+</filter>
+<filter-mapping>
+    <filter-name>springSessionRepositoryFilter</filter-name>
+    <url-pattern>/*</url-pattern>
+    <dispatcher>REQUEST</dispatcher>
+    <dispatcher>ERROR</dispatcher>
+</filter-mapping>
+

配置完成,使用RedisDesktopManager查看结果:

测试:

`,9),la={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},ra=a("br",null,null,-1),pa=a("figure",null,[a("img",{src:"http://image.wenzhihuai.com/images/20171105050714.png",alt:"",tabindex:"0"}),a("figcaption")],-1),ca=a("p",null,"访问技术杂谈页面,此时nginx将请求转发到119.23.46.71服务器,session为28424f91-5bc5-4bba-99ec-f725401d7318。",-1),ma=a("figure",null,[a("img",{src:"http://image.wenzhihuai.com/images/20171105050757.png",alt:"",tabindex:"0"}),a("figcaption")],-1),ua=a("p",null,"点击生活笔记页面,转发到的服务器为47.95.10.139,session为28424f91-5bc5-4bba-99ec-f725401d7318,与上面相同。session已保持一致。",-1),da=a("figure",null,[a("img",{src:"http://image.wenzhihuai.com/images/20171105050849.png",alt:"",tabindex:"0"}),a("figcaption")],-1),Qa=a("strong",null,"值得注意的是:同一个浏览器,在没有关闭的情况下,即使通过域名访问和ip访问得到的session是不同的。",-1),ga=a("br",null,null,-1),Ta=a("br",null,null,-1),ha={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},fa=a("br",null,null,-1),va={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"};function ka(xa,_a){const t=r("ExternalLinkIcon");return o(),i("div",null,[a("h1",c,[m,n(),a("a",u,[n("5.小集群部署.md"),s(t)])]),a("p",null,[n("欢迎访问我的个人网站O(∩_∩)O哈哈~希望大佬们能给个star,个人网站网址:"),a("a",d,[n("http://www.wenzhihuai.com"),s(t)]),n(",个人网站代码地址:"),a("a",Q,[n("https://github.com/Zephery/newblog"),s(t)]),n("。"),g,n(" 洋洋洒洒的买了两个服务器,用来学习分布式、集群之类的东西,整来整去,感觉分布式这种东西没人指导一下真的是太抽象了,先从网站的分布式部署一步一步学起来吧,虽然网站本身的访问量不大==。")]),T,a("p",null,[n("一般情况下,当单实例无法支撑起用户的请求时,就需要就行扩容,部署的服务器可以分机房、分地域。而分地域会导致请求分配到太远的地区,比如:深圳的用户却访问到了北京的节点,然后还得从北京返回处理之后的数据,光是来回就至少得30ms。这部分可以通过智能DNS(就近访问)解决。而分机房,需要将请求合理的分配到不同的服务器,这部分就是我们所需要处理的。"),h,n(" 通常,负载均衡分为硬件和软件两种,硬件层的比较牛逼,将4-7层负载均衡功能做到一个硬件里面,如F5,梭子鱼等。目前主流的软件负载均衡分为四层和七层,LVS属于四层负载均衡,工作在tcp/ip协议栈上,通过修改网络包的ip地址和端口来转发, 由于效率比七层高,一般放在架构的前端。七层的负载均衡有nginx, haproxy, apache等,虽然nginx自1.9.0版本后也开始支持四层的负载均衡,但是暂不讨论(我木有硬件条件)。下图来自"),a("a",f,[n("张开涛"),s(t)]),n("的《亿级流量网站架构核心技术》")]),v,k,x,_,b,a("p",null,[n("可以选择tar.gz、yum、rpm安装等,这里,由于编译、nginx配置比较复杂,要是没有把握还是使用rpm来安装吧,比较简单。从"),a("a",q,[n("https://pkgs.org/download/nginx"),s(t)]),n("可以找到最新的rpm包,然后rpm -ivh 文件,然后在命令行中输入nginx即可启动,可以使用netstat检查一下端口。")]),w,a("p",null,[n("Nginx常用的算法有:"),y,n(" (1)round-robin:轮询,nginx默认的算法,从词语上可以看出,轮流访问服务器,也可以通过weight来控制访问次数。"),H,n(" (2)ip_hash:根据访客的ip,一个ip地址对应一个服务器。"),L,n(" (3)hash算法:hash算法常用的方式有根据uri、动态指定的consistent_key两种。"),z,n(" 使用hash算法的缺点是当添加服务器的时候,只有少部分的uri能够被重新分配到新的服务器。这里,本站使用的是hash uri的算法,将不同的uri分配到不同的服务器,但是由于是不同的服务器,tomcat中的session是不一致,解决办法是"),a("a",M,[n("tomcat session"),s(t)]),n("的共享。额。。。可惜本站目前没有什么能够涉及到登陆什么session的问题。")]),D,a("p",null,[n("配置完上流服务器之后,需要配置Http的代理,将请求的端口转发到proxy_pass设定的上流服务器,即当我们访问"),a("a",Z,[n("http://wwww.wenzhihuai.com的时候"),s(t)]),n(",请求会被转发到backend中配置的服务器,此处为http://47.95.10.139:8080或者"),a("a",S,[n("http://119.23.46.71:8080"),s(t)]),n("。但是,仔细注意之后,我们会发现,tomcat中的访问日志ip来源都是127.0.0.1,相当于本地访问自己的资源。由于后台中有处理ip的代码,对客户端的ip、访问uri等记录下来,所以需要设置nginx来获取用户的实际ip,参考"),a("a",j,[n("nginx 配置"),s(t)]),n("。参考文中的一句话:经过反向代理后,由于在客户端和web服务器之间增加了中间层,因此web服务器无法直接拿到客户端的ip,通过"),a("mjx-container",$,[(o(),i("svg",F,E)),I]),n("remote_addr变量时获得的是用户的真实ip,如果我们想要在web端获得用户的真实ip,就必须在nginx这里作一个赋值操作,如下:")]),P,a("p",null,[n("X-Forwarded-For:squid开发的,用于识别通过HTTP代理或负载平衡器原始IP一个连接到Web服务器的客户机地址的非rfc标准,这个不是默认有的,其经过代理转发之后,格式为client1, proxy1, proxy2,如果想通过这个变量来获取用户的ip,那么需要和"),a("mjx-container",R,[(o(),i("svg",B,N)),X]),n("proxy_add_x_forwarded_for:现在的"),a("mjx-container",V,[(o(),i("svg",O,J)),U]),n("remote_addr部分的值是上一台nginx的ip地址,于是通过这个赋值以后现在的X-Forwarded-For的值就变成了“用户的真实ip,第一台nginx的ip”。")]),K,a("p",null,[a("a",W,[n("HTTPS"),s(t)]),n("(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的安全版。即HTTP下加入SSL层,HTTPS的安全基础是SSL,因此加密的详细内容就需要SSL。一般情况下,能通过服务器的ssh来生成ssl证书,但是如果使用是自己的,一般浏览器(谷歌、360等)都会报证书不安全的错误,正常用户都不敢访问吧==,所以现在使用的是腾讯跟别的机构颁发的:")]),Y,a("p",null,[n("分布式情况下难免会要解决session共享的问题,目前推荐的方法基本上都是使用redis,网上查找的方法目前流行的有下面四种,参考自"),a("a",aa,[n("tomcat 集群中 session 共"),s(t)]),n(":"),na,n(" 1.使用 filter 方法存储。(推荐,因为它的服务器使用范围比较多,不仅限于tomcat ,而且实现的原理比较简单容易控制。)"),ta,n(" 2.使用 tomcat sessionmanager 方法存储。(直接配置即可)"),sa,n(" 3.使用 terracotta 服务器共享。(不知道,不了解)"),ea,n(" 4.使用spring-session。(spring的一个小项目,其原理也和第一种基本一致)")]),a("p",null,[n("本站使用spring-session,毕竟是spring下的子项目,学习下还是挺好的。参考"),a("a",oa,[n("Spring-Session官网"),s(t)]),n("。官方文档提供了spring-boot、spring等例子,可以参考参考。目前最新版本是2.0.0,不同版本使用方式不同,建议看官网的文档吧。")]),ia,a("p",null,[n("访问"),a("a",la,[n("http://www.wenzhihuai.com"),s(t)]),ra,n(" tail -f localhost_access_log.2017-11-05.txt查看日志,然后清空一下当前记录")]),pa,ca,ma,ua,da,a("p",null,[Qa,ga,n(" 欢迎访问我的个人网站O(∩_∩)O哈哈~希望能给个star"),Ta,n(" 个人网站网址:"),a("a",ha,[n("http://www.wenzhihuai.com"),s(t)]),fa,n(" 个人网站代码地址:"),a("a",va,[n("https://github.com/Zephery/newblog"),s(t)])])])}const wa=l(p,[["render",ka],["__file","5.小集群部署.html.vue"]]);export{wa as default}; diff --git a/assets/52pp5f-0miE36nj.png b/assets/52pp5f-0miE36nj.png new file mode 100644 index 00000000..f28d6dd7 Binary files /dev/null and b/assets/52pp5f-0miE36nj.png differ diff --git a/assets/5fxmcv-O2AtIfM7.png b/assets/5fxmcv-O2AtIfM7.png new file mode 100644 index 00000000..4f99ba7c Binary files /dev/null and b/assets/5fxmcv-O2AtIfM7.png differ diff --git "a/assets/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html-2L7c0TUt.js" "b/assets/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html-2L7c0TUt.js" new file mode 100644 index 00000000..12564de5 --- /dev/null +++ "b/assets/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html-2L7c0TUt.js" @@ -0,0 +1,65 @@ +import{_ as s}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as l,o as r,c as d,a as i,d as e,b as a,e as t}from"./app-hbwtiwmf.js";const m={},c=t(`

6.数据库备份

先来回顾一下上一篇的小集群架构,tomcat集群,nginx进行反向代理,服务器异地:

由上一篇讲到,部署的时候,将war部署在不同的服务器里,通过spring-session实现了session共享,基本的分布式部署还算是完善了点,但是想了想数据库的访问会不会延迟太大,毕竟一个服务器在北京,一个在深圳,然后试着ping了一下:

果然,36ms。。。看起来挺小的,但是对比一下sql执行语句的时间:

大部分都能在10ms内完成,而最长的语句是insert语句,可见,由于异地导致的36ms延时还是比较大的,捣鼓了一下,最后还是选择换个架构,每个服务器读取自己的数据库,然后数据库底层做一下主主复制,让数据同步。最终架构如下:

一、MySql的复制

数据库复制的基本问题就是让一台服务器的数据与其他服务器保持同步。MySql目前支持两种复制方式:基于行的复制和基于语句的复制,这两者的基本过程都是在主库上记录二进制的日志、在备库上重放日志的方式来实现异步的数据复制。其过程分为三步:
(1)master将改变记录到二进制日志(binary log)中(这些记录叫做二进制日志事件,binary log events);
(2)slave将master的binary log events拷贝到它的中继日志(relay log);
(3)slave重做中继日志中的事件,将改变反映它自己的数据。

该过程的第一部分就是master记录二进制日志。在每个事务更新数据完成之前,master在二日志记录这些改变。MySQL将事务串行的写入二进制日志,即使事务中的语句都是交叉执行的。在事件写入二进制日志完成后,master通知存储引擎提交事务。
下一步就是slave将master的binary log拷贝到它自己的中继日志。首先,slave开始一个工作线程——I/O线程。I/O线程在master上打开一个普通的连接,然后开始binlog dump process。Binlog dump process从master的二进制日志中读取事件,如果已经跟上master,它会睡眠并等待master产生新的事件。I/O线程将这些事件写入中继日志。
SQL slave thread处理该过程的最后一步。SQL线程从中继日志读取事件,更新slave的数据,使其与master中的数据一致。只要该线程与I/O线程保持一致,中继日志通常会位于OS的缓存中,所以中继日志的开销很小。
此外,在master中也有一个工作线程:和其它MySQL的连接一样,slave在master中打开一个连接也会使得master开始一个线程。复制过程有一个很重要的限制——复制在slave上是串行化的,也就是说master上的并行更新操作不能在slave上并行操作。
MySql的基本复制方式有主从复制、主主复制,主主复制即把主从复制的配置倒过来再配置一遍即可,下面的配置则是主从复制的过程,到时候可自行改为主主复制。其他的架构如:一主库多备库、环形复制、树或者金字塔型都是基于这两种方式,可参考《高性能MySql》。

二、配置过程

2.1 创建所用的复制账号

由于是个自己的小网站,就不做过多的操作了,直接使用root账号

2.2 配置master

接下来要对mysql的serverID,日志位置,复制方式等进行操作,使用vim打开my.cnf。

[client]
+default-character-set=utf8
+
+[mysqld]
+character_set_server=utf8
+init_connect= SET NAMES utf8
+
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+
+symbolic-links=0
+
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
+# master
+log-bin=mysql-bin
+# 设为基于行的复制
+binlog-format=ROW
+# 设置server的唯一id
+server-id=2
+# 忽略的数据库,不使用备份
+binlog-ignore-db=information_schema
+binlog-ignore-db=cluster
+binlog-ignore-db=mysql
+# 要进行备份的数据库
+binlog-do-db=myblog
+

重启Mysql之后,查看主库状态,show master status。

其中,File为日志文件,指定Slave从哪个日志文件开始读复制数据,Position为偏移,从哪个POSITION号开始读,Binlog_Do_DB为要备份的数据库。

2.3 配置slave

从库的配置跟主库类似,vim /etc/my.cnf配置从库信息。


+[client]
+default-character-set=utf8
+
+[mysqld]
+character_set_server=utf8
+init_connect= SET NAMES utf8
+
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+
+symbolic-links=0
+
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
+# slave
+log-bin=mysql-bin
+# 服务器唯一id
+server-id=3
+# 不备份的数据库
+binlog-ignore-db=information_schema
+binlog-ignore-db=cluster
+binlog-ignore-db=mysql
+# 需要备份的数据库
+replicate-do-db=myblog
+# 其他相关信息
+slave-skip-errors=all
+slave-net-timeout=60
+# 开启中继日志
+relay_log         = mysql-relay-bin
+# 
+log_slave_updates = 1
+# 防止改变数据
+read_only         = 1
+

重启slave,同时启动复制,还需要调整一下命令。

mysql> CHANGE MASTER TO MASTER_HOST = '119.23.46.71', MASTER_USER = 'root', MASTER_PASSWORD = 'helloroot', MASTER_PORT = 3306, MASTER_LOG_FILE = 'mysql-bin.000009', MASTER_LOG_POS = 346180; 
+
+

可以看见slave已经开始进行同步了。我们使用show slave status\\G来查看slave的状态。

其中日志文件和POSITION不一致是合理的,配置好了的话,即使重启,也不会影响到主从复制的配置。

某天在Github上漂游,发现了阿里的canal,同时才知道上面这个业务是叫异地跨机房同步,早期,阿里巴巴B2B公司因为存在杭州和美国双机房部署,存在跨机房同步的业务需求。不过早期的数据库同步业务,主要是基于trigger的方式获取增量变更,不过从2010年开始,阿里系公司开始逐步的尝试基于数据库的日志解析,获取增量变更进行同步,由此衍生出了增量订阅&消费的业务。下面是基本的原理:

原理相对比较简单:

1.canal模拟mysql slave的交互协议,伪装自己为mysql slave,向mysql master发送dump协议
2.mysql master收到dump请求,开始推送binary log给slave(也就是canal)
3.canal解析binary log对象(原始为byte流)

`,34),v={href:"https://github.com/alibaba/canal",target:"_blank",rel:"noopener noreferrer"},o=i("figure",null,[i("img",{src:"http://image.wenzhihuai.com/images/20171120100237.png",alt:"",tabindex:"0"}),i("figcaption")],-1),b={href:"https://github.com/alibaba/otter",target:"_blank",rel:"noopener noreferrer"},u=i("p",null,"公司又要996了,实在是忙不过来,感觉自己写的还是急躁了点,困==",-1);function g(p,h){const n=l("ExternalLinkIcon");return r(),d("div",null,[c,i("p",null,[e("其中,配置过程如下:"),i("a",v,[e("https://github.com/alibaba/canal"),a(n)]),e(",可以搭配Zookeeper使用。在ZKUI中能够查看到节点:")]),o,i("p",null,[e("一般情况下,还要配合阿里的另一个开源产品使用"),i("a",b,[e("otter"),a(n)]),e(",相关文档还是找找GitHub吧,个人搭建完了之后,用起来还是不如直接使用mysql的主主复制,而且异地机房同步这种大企业才有的业务。")]),u])}const y=s(m,[["render",g],["__file","6.数据库备份.html.vue"]]);export{y as default}; diff --git "a/assets/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html-LAUkmUJn.js" "b/assets/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html-LAUkmUJn.js" new file mode 100644 index 00000000..1b563e36 --- /dev/null +++ "b/assets/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html-LAUkmUJn.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-79ad699f","path":"/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html","title":"6.数据库备份","lang":"zh-CN","frontmatter":{"description":"6.数据库备份 先来回顾一下上一篇的小集群架构,tomcat集群,nginx进行反向代理,服务器异地: 由上一篇讲到,部署的时候,将war部署在不同的服务器里,通过spring-session实现了session共享,基本的分布式部署还算是完善了点,但是想了想数据库的访问会不会延迟太大,毕竟一个服务器在北京,一个在深圳,然后试着ping了一下:","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"6.数据库备份"}],["meta",{"property":"og:description","content":"6.数据库备份 先来回顾一下上一篇的小集群架构,tomcat集群,nginx进行反向代理,服务器异地: 由上一篇讲到,部署的时候,将war部署在不同的服务器里,通过spring-session实现了session共享,基本的分布式部署还算是完善了点,但是想了想数据库的访问会不会延迟太大,毕竟一个服务器在北京,一个在深圳,然后试着ping了一下:"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"6.数据库备份\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":3,"title":"2.1 创建所用的复制账号","slug":"_2-1-创建所用的复制账号","link":"#_2-1-创建所用的复制账号","children":[]},{"level":3,"title":"2.2 配置master","slug":"_2-2-配置master","link":"#_2-2-配置master","children":[]},{"level":3,"title":"2.3 配置slave","slug":"_2-3-配置slave","link":"#_2-3-配置slave","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":5.74,"words":1722},"filePathRelative":"personalWebsite/6.数据库备份.md","localizedDate":"2024年1月25日","excerpt":"

6.数据库备份

\\n

先来回顾一下上一篇的小集群架构,tomcat集群,nginx进行反向代理,服务器异地:

\\n
\\"\\"
\\n

由上一篇讲到,部署的时候,将war部署在不同的服务器里,通过spring-session实现了session共享,基本的分布式部署还算是完善了点,但是想了想数据库的访问会不会延迟太大,毕竟一个服务器在北京,一个在深圳,然后试着ping了一下:

","autoDesc":true}');export{e as data}; diff --git "a/assets/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html--pKjO7qe.js" "b/assets/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html--pKjO7qe.js" new file mode 100644 index 00000000..8bb1fe90 --- /dev/null +++ "b/assets/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html--pKjO7qe.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-8658e60a","path":"/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html","title":"7.那些牛逼的插件","lang":"zh-CN","frontmatter":{"description":"7.那些牛逼的插件 欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog 。 建站的一开始,我也想自己全部实现,各种布局,各种炫丽的效果,想做点能让大家佩服的UI出来,但是,事实上,自己作为专注Java的程序员,前端的东西一碰脑子就有“我又不是前端,浪费时间在这合适么?”这种想法,捣鼓来捣鼓去,做出的东西实在是没法看,我就觉得,如果自己的“产品”连自己都看不下去了,那还好意思给别人看?特别是留言板那块,初版的页面简直low的要死。所以,还是踏踏实实的“站在巨人的肩膀上”吧,改用别人的插件。但不要纯粹的使用别人的博客模板了,如hexo,wordpress这些,就算是自己拼凑过来的也比这些强。下面是本博客中所用到的插件,给大家介绍介绍,共同学习学习。 本站主要用到的插件有: 1.wowslider 2.畅言 3.Editor.md 4.highchart、echart 5.百度分享 6.waterfall.js 7.心知天气 8.标签云","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"7.那些牛逼的插件"}],["meta",{"property":"og:description","content":"7.那些牛逼的插件 欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog 。 建站的一开始,我也想自己全部实现,各种布局,各种炫丽的效果,想做点能让大家佩服的UI出来,但是,事实上,自己作为专注Java的程序员,前端的东西一碰脑子就有“我又不是前端,浪费时间在这合适么?”这种想法,捣鼓来捣鼓去,做出的东西实在是没法看,我就觉得,如果自己的“产品”连自己都看不下去了,那还好意思给别人看?特别是留言板那块,初版的页面简直low的要死。所以,还是踏踏实实的“站在巨人的肩膀上”吧,改用别人的插件。但不要纯粹的使用别人的博客模板了,如hexo,wordpress这些,就算是自己拼凑过来的也比这些强。下面是本博客中所用到的插件,给大家介绍介绍,共同学习学习。 本站主要用到的插件有: 1.wowslider 2.畅言 3.Editor.md 4.highchart、echart 5.百度分享 6.waterfall.js 7.心知天气 8.标签云"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"7.那些牛逼的插件\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"wowslider","slug":"wowslider","link":"#wowslider","children":[]},{"level":2,"title":"畅言","slug":"畅言","link":"#畅言","children":[]},{"level":2,"title":"Editor.md","slug":"editor-md","link":"#editor-md","children":[]},{"level":2,"title":"图表","slug":"图表","link":"#图表","children":[]},{"level":2,"title":"百度分享","slug":"百度分享","link":"#百度分享","children":[]},{"level":2,"title":"瀑布流","slug":"瀑布流","link":"#瀑布流","children":[]},{"level":2,"title":"天气插件","slug":"天气插件","link":"#天气插件","children":[]},{"level":2,"title":"标签云","slug":"标签云","link":"#标签云","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":7.2,"words":2161},"filePathRelative":"personalWebsite/7.那些牛逼的插件.md","localizedDate":"2024年1月25日","excerpt":"

7.那些牛逼的插件

\\n

欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog
\\n建站的一开始,我也想自己全部实现,各种布局,各种炫丽的效果,想做点能让大家佩服的UI出来,但是,事实上,自己作为专注Java的程序员,前端的东西一碰脑子就有“我又不是前端,浪费时间在这合适么?”这种想法,捣鼓来捣鼓去,做出的东西实在是没法看,我就觉得,如果自己的“产品”连自己都看不下去了,那还好意思给别人看?特别是留言板那块,初版的页面简直low的要死。所以,还是踏踏实实的“站在巨人的肩膀上”吧,改用别人的插件。但不要纯粹的使用别人的博客模板了,如hexo,wordpress这些,就算是自己拼凑过来的也比这些强。下面是本博客中所用到的插件,给大家介绍介绍,共同学习学习。
\\n本站主要用到的插件有:
\\n1.wowslider
\\n2.畅言
\\n3.Editor.md
\\n4.highchart、echart
\\n5.百度分享
\\n6.waterfall.js
\\n7.心知天气
\\n8.标签云

","autoDesc":true}');export{e as data}; diff --git "a/assets/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html-WOroqLxh.js" "b/assets/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html-WOroqLxh.js" new file mode 100644 index 00000000..0b9982c6 --- /dev/null +++ "b/assets/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html-WOroqLxh.js" @@ -0,0 +1,14 @@ +import{_ as i}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as r,c as l,a as e,d as n,b as a,e as s}from"./app-hbwtiwmf.js";const c={},h=e("h1",{id:"_7-那些牛逼的插件",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_7-那些牛逼的插件","aria-hidden":"true"},"#"),n(" 7.那些牛逼的插件")],-1),p={href:"http://www.wenzhihuai.com/",target:"_blank",rel:"noopener noreferrer"},d={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},u=e("br",null,null,-1),_=e("br",null,null,-1),g=e("br",null,null,-1),m=e("br",null,null,-1),b=e("br",null,null,-1),f={href:"http://3.Editor.md",target:"_blank",rel:"noopener noreferrer"},w=e("br",null,null,-1),k=e("br",null,null,-1),E=e("br",null,null,-1),v=e("br",null,null,-1),x=e("br",null,null,-1),B=e("h2",{id:"wowslider",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#wowslider","aria-hidden":"true"},"#"),n(" wowslider")],-1),y={href:"http://wowslider.com/",target:"_blank",rel:"noopener noreferrer"},z={href:"https://github.com/WOWSlider/WOWSlider",target:"_blank",rel:"noopener noreferrer"},A={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},C=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171121023427.png",alt:"",tabindex:"0"}),e("figcaption")],-1),j={href:"https://fonts.googleapis.com/css?family=Arimo&subset=latin,cyrillic,latin-ext%EF%BC%8C%E7%94%B1%E4%BA%8E%E4%B8%80%E8%88%AC%E7%94%A8%E6%88%B7%E4%B8%8D%E8%83%BD%E8%AE%BF%E9%97%AE%E8%B0%B7%E6%AD%8C%EF%BC%8C%E4%BC%9A%E5%AF%BC%E8%87%B4%E7%BD%91%E9%A1%B5%E5%8A%A0%E8%BD%BD%E9%80%9F%E5%BA%A6%E5%8F%8A%E5%85%B6%E7%BC%93%E6%85%A2%EF%BC%8C%E6%89%80%E4%BB%A5%EF%BC%8C%E5%8E%BB%E6%8E%89%E4%B8%BA%E5%A6%99",target:"_blank",rel:"noopener noreferrer"},D=e("h2",{id:"畅言",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#畅言","aria-hidden":"true"},"#"),n(" 畅言")],-1),S={href:"http://www.wenzhihuai.com/board.html",target:"_blank",rel:"noopener noreferrer"},F=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171121024358.png",alt:"",tabindex:"0"}),e("figcaption")],-1),W={id:"editor-md",tabindex:"-1"},Z=e("a",{class:"header-anchor",href:"#editor-md","aria-hidden":"true"},"#",-1),H={href:"http://Editor.md",target:"_blank",rel:"noopener noreferrer"},R=e("br",null,null,-1),G={href:"https://github.com/pandao/editor.md",target:"_blank",rel:"noopener noreferrer"},O=s('

代码样式,这一点是不如WORDPRESS的插件了,不过已经可以了。

图表

目前最常用的是highcharts跟echart,目前个人博客中的日志系统主要还是采用了highcharts,主要还是颜色什么的格调比较相符吧,其次是因为对echarts印象不太友好,比如下面做这张,打开网页后,缩小浏览器,百度的地域图却不能自适应,出现了越界,而highcharts的全部都能自适应调整。想起有次面试,我说我用的highcharts,面试官一脸嫌弃。。。(网上这么多人鄙视百度是假的?)

不过地图确确实实是echarts的优势,毕竟还是自家的东西了解自家,不过前段时间去看了看echarts的官网,已经不提供下载了。如果有需要,还是去csdn上搜索吧,或者替换为highmap。

百度分享

',9),P={href:"http://www.jiathis.com/",target:"_blank",rel:"noopener noreferrer"},I={href:"http://share.baidu.com/code/advance#tools",target:"_blank",rel:"noopener noreferrer"},N=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171121022116.png",alt:"",tabindex:"0"}),e("figcaption")],-1),V={href:"https://github.com/Zephery/newblog/blob/master/src/main/webapp/board.jsp",target:"_blank",rel:"noopener noreferrer"},M=s(`
#share a {
+    width: 34px;
+    height: 34px;
+    padding: 0;
+    margin: 6px;
+    border-radius: 25px;
+    transition: all .4s;
+}
+/*主要的是替换掉backgound的背景图片*/
+#share a.bds_qzone {
+    background: url(http://image.wenzhihuai.com/t_QQZone.png) no-repeat;
+    background-size: 34px 34px;
+}
+

改完之后的效果。

瀑布流

`,4),Q={href:"https://www.zhihu.com/question/20653270",target:"_blank",rel:"noopener noreferrer"},q=e("a",{href:""},"waterfall.js",-1),L=e("a",{href:""},"masory.js",-1),U=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171125103716.png",alt:"",tabindex:"0"}),e("figcaption")],-1),J=e("h2",{id:"天气插件",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#天气插件","aria-hidden":"true"},"#"),n(" 天气插件")],-1),T={href:"http://cj.weather.com.cn/",target:"_blank",rel:"noopener noreferrer"},K={href:"https://www.seniverse.com/widget/intro",target:"_blank",rel:"noopener noreferrer"},X=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171125105127.png",alt:"",tabindex:"0"}),e("figcaption")],-1),Y=e("h2",{id:"标签云",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#标签云","aria-hidden":"true"},"#"),n(" 标签云")],-1),$=e("p",null,"标签云,弄得好的话应该说是一个网站的点缀。现在好像比较流行3D的标签云?像下面这种。",-1),ee=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171127033202.png",alt:"",tabindex:"0"}),e("figcaption")],-1),ne={href:"https://github.com/Zephery/newblog/blob/master/src/main/webapp/css/newlypublished.css",target:"_blank",rel:"noopener noreferrer"},te=e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/20171127033945.png",alt:"",tabindex:"0"}),e("figcaption")],-1),ae=e("h1",{id:"总结",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#总结","aria-hidden":"true"},"#"),n(" 总结")],-1),se=e("p",null,[n("作为一个后端人员,调css和js真是痛苦==,好在坚持下来了,虽然还是很多不足,以后有时间慢慢改。说了那么多,感觉自己还是菜的抠脚。"),e("br"),n(" 题外话,搭建一个博客,对于一个新近程序员来说真的是锻炼自己的一个好机会,能够认识到从前端、java后台、linux、jvm等等知识,只是真的有点耗时间(还不如把时间耗在Spring源码),如果不采用别人的框架的话,付出的代价还是蛮大的(所以不要鄙视我啦)。没有什么能够一举两得,看自己的取舍吧。加油💪(ง •_•)ง")],-1),ie={href:"http://www.wenzhihuai.com/",target:"_blank",rel:"noopener noreferrer"},oe={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"};function re(le,ce){const t=o("ExternalLinkIcon");return r(),l("div",null,[h,e("p",null,[n("欢迎访问我的网站"),e("a",p,[n("http://www.wenzhihuai.com/"),a(t)]),n(" 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址"),e("a",d,[n("https://github.com/Zephery/newblog"),a(t)]),n(" 。"),u,n(" 建站的一开始,我也想自己全部实现,各种布局,各种炫丽的效果,想做点能让大家佩服的UI出来,但是,事实上,自己作为专注Java的程序员,前端的东西一碰脑子就有“我又不是前端,浪费时间在这合适么?”这种想法,捣鼓来捣鼓去,做出的东西实在是没法看,我就觉得,如果自己的“产品”连自己都看不下去了,那还好意思给别人看?特别是留言板那块,初版的页面简直low的要死。所以,还是踏踏实实的“站在巨人的肩膀上”吧,改用别人的插件。但不要纯粹的使用别人的博客模板了,如hexo,wordpress这些,就算是自己拼凑过来的也比这些强。下面是本博客中所用到的插件,给大家介绍介绍,共同学习学习。"),_,n(" 本站主要用到的插件有:"),g,n(" 1.wowslider"),m,n(" 2.畅言"),b,e("a",f,[n("3.Editor.md"),a(t)]),w,n(" 4.highchart、echart"),k,n(" 5.百度分享"),E,n(" 6.waterfall.js"),v,n(" 7.心知天气"),x,n(" 8.标签云")]),B,e("p",null,[n("可能是我这网站中最炫的东西了,图片能够自动像幻灯片一样自动滚动,让网站的首页一看起来就高大上,简直就是建站必备的东西,而且安装也及其简单,有兴趣可以点击"),e("a",y,[n("官网"),a(t)]),n("看看。GitHub里也开放了"),e("a",z,[n("源代码"),a(t)]),n("。安装过程:自己选择“幻灯片”切换效果,保存为html就行了,WORDPREESS中好像有集成这个插件的,做的还更好。感兴趣可以点击"),e("a",A,[n("我的博客首页"),a(t)]),n("看一看。")]),C,e("p",null,[e("strong",null,[n("不过还有个值得注意的问题,就是wowslider里面带有一个googleapis的服务,即"),e("a",j,[n("https://fonts.googleapis.com/css?family=Arimo&subset=latin,cyrillic,latin-ext,由于一般用户不能访问谷歌,会导致网页加载速度及其缓慢,所以,去掉为妙"),a(t)])])]),D,e("p",null,[n("作为社交评论的工具,虽然说表示还是想念以前的多说,但是畅言现在做得还是好了,有评论审核,评论导出导入等功能,如果浏览量大的话,还能提供广告服务,让站长也能拿到一丢丢的广告费。本博客中使用了畅言的基本评论、获取某篇文章评论数的功能。可以到我这里"),e("a",S,[n("留言"),a(t)]),n("哈")]),F,e("h2",W,[Z,n(),e("a",H,[n("Editor.md"),a(t)])]),e("p",null,[n("一款能将markdown解析为html的插件,国人的作品,博客的文章编辑器一开始想使用的是markdown,想法是:写文章、保存数据库都是markdown格式的,保存在数据库中,读取时有需要解析markdown,这个过程是有点耗时的,但是相比把html式的网页保存在数据库中友好点吧,因为如果一篇文章比较长的话,转成html的格式,光是大小估计也得超过几十kb?所以,还是本人选择的是一切都用源markdown。"),R,e("a",G,[n("editor.md"),a(t)]),n(",是一款开源的、可嵌入的 Markdown 在线编辑器(组件),基于 CodeMirror、jQuery 和 Marked 构建。页面看起来还是美观的,相比WORDPRESS的那些牛逼插件还差那么一点点,不过从普通人的眼光来看,应该是可以的了。此处,我用它作为解析网页的利器,还有就是后台编辑也是用的这个。")]),O,e("p",null,[n("作为一个以博客为主的网站,免不了使用一些社会化分享的工具,目前主要是"),e("a",P,[n("jiathis"),a(t)]),n("和百度分享,这两者的ui都是相似的(丑爆了)。凭我个人的感觉,jiathis加载实在是太过于缓慢,这点是无法让人忍受的,只好投靠百度。百度分享类似于jiathis,安装也很简单,具体见官网"),e("a",I,[n("http://share.baidu.com/code/advance#tools"),a(t)]),n("。一直点点点,配置完之后,就是下图这种,丑爆了是不是?")]),N,e("p",null,[n("好在对它的美观改变不是很难,此处参考了别人的UI设计,原作者我忘记怎么联系他了。其原理主要是使用图片来替换掉原本的东西。完整的源码可以点击"),e("a",V,[n("此处"),a(t)]),n("。")]),M,e("p",null,[n("有段时间,瀑布流特别流行?还有段时间,瀑布流开始遭到各种抵制。。。"),e("a",Q,[n("看看知乎的人怎么说"),a(t)]),n(",大部分人不喜欢的原因是让人觉得视觉疲劳,不过瀑布流最大的好处还是有的:提高发现好图的效率以及图片列表页极强的视觉感染力。没错,我还是想把自己的网站弄得铉一些==,所以采用了瀑布流(不过效果不是很好,某些浏览器甚至加载出错),这个大bug有时间再改,毕竟花了很多时间做的这个,效果确实不咋地。目前主要的瀑布流有"),q,n("和"),L,n("。这一块目前还不是很完善,希望能得到各位大佬的指点。")]),U,J,e("p",null,[n("此类咨询服务还是网上还是挺多的,这一块不知道是不是所谓的“画蛇添足”这部分,主要是我觉得网站右边这部分老是少了点什么,所以加上了天气插件。目前常用的天气插件有"),e("a",T,[n("中国天气网"),a(t)]),n(","),e("a",K,[n("心知天气"),a(t)]),n("等。安装方式见各自的官网,这里不再阐述,我使用的是心知天气。注意:心知天气限制流量的,一个小时内只能使用400次,如果超出了会失效,当然也可以付费使用。")]),X,Y,$,ee,e("p",null,[n("从个人的网站风格来看,比较适应PHP形式的,有点颜色而又不绚丽的即可,之前用的跟分类的一样的样式,即双纵列的样式,美观度还行,虽然老是感觉有点怪怪的,如果某个标签的字数过长怎么办,岂不是要顶出div了。所以还是选择换另一种风格,最终偶然一次找到了下面这种,能够自适应宽度,颜色虽然鲜艳了点(以后有空再调一下吧),源码见"),e("a",ne,[n("style.css"),a(t)]),n("。 下图为目前的标签页。")]),te,ae,se,e("p",null,[n("欢迎访问我的网站"),e("a",ie,[n("http://www.wenzhihuai.com/"),a(t)]),n(" 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址"),e("a",oe,[n("https://github.com/Zephery/newblog"),a(t)]),n(" 。")])])}const de=i(c,[["render",re],["__file","7.那些牛逼的插件.html.vue"]]);export{de as default}; diff --git a/assets/755525-20220124160657219-1269826381-TCdcRh3a.png b/assets/755525-20220124160657219-1269826381-TCdcRh3a.png new file mode 100644 index 00000000..dcef6859 Binary files /dev/null and b/assets/755525-20220124160657219-1269826381-TCdcRh3a.png differ diff --git a/assets/755525-20220124160709513-361605195-8g-Fyjbx.png b/assets/755525-20220124160709513-361605195-8g-Fyjbx.png new file mode 100644 index 00000000..3c90de5c Binary files /dev/null and b/assets/755525-20220124160709513-361605195-8g-Fyjbx.png differ diff --git a/assets/755525-20220124160719006-851383635-wz6ZuPyA.png b/assets/755525-20220124160719006-851383635-wz6ZuPyA.png new file mode 100644 index 00000000..8e216c8b Binary files /dev/null and b/assets/755525-20220124160719006-851383635-wz6ZuPyA.png differ diff --git a/assets/755525-20230827193604663-146471729-Dklv6VTq.png b/assets/755525-20230827193604663-146471729-Dklv6VTq.png new file mode 100644 index 00000000..78106193 Binary files /dev/null and b/assets/755525-20230827193604663-146471729-Dklv6VTq.png differ diff --git a/assets/755525-20230827193604936-1596575555-InMR9nhl.png b/assets/755525-20230827193604936-1596575555-InMR9nhl.png new file mode 100644 index 00000000..69008f1a Binary files /dev/null and b/assets/755525-20230827193604936-1596575555-InMR9nhl.png differ diff --git a/assets/755525-20230827193609186-1264647264-45xPkPYe.png b/assets/755525-20230827193609186-1264647264-45xPkPYe.png new file mode 100644 index 00000000..9805b9fe Binary files /dev/null and b/assets/755525-20230827193609186-1264647264-45xPkPYe.png differ diff --git "a/assets/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html-O9J2qs51.js" "b/assets/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html-O9J2qs51.js" new file mode 100644 index 00000000..cde75a8d --- /dev/null +++ "b/assets/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html-O9J2qs51.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-7e9e4a32","path":"/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html","title":"8.基于贝叶斯的情感分析","lang":"zh-CN","frontmatter":{"description":"8.基于贝叶斯的情感分析","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"8.基于贝叶斯的情感分析"}],["meta",{"property":"og:description","content":"8.基于贝叶斯的情感分析"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"8.基于贝叶斯的情感分析\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.04,"words":11},"filePathRelative":"personalWebsite/8.基于贝叶斯的情感分析.md","localizedDate":"2024年1月25日","excerpt":"

8.基于贝叶斯的情感分析

\\n","autoDesc":true}');export{e as data}; diff --git "a/assets/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html-uHKTPHjR.js" "b/assets/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html-uHKTPHjR.js" new file mode 100644 index 00000000..eab17594 --- /dev/null +++ "b/assets/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html-uHKTPHjR.js" @@ -0,0 +1 @@ +import{_}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c as a,a as e,d as o}from"./app-hbwtiwmf.js";const r={},c=e("h1",{id:"_8-基于贝叶斯的情感分析",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_8-基于贝叶斯的情感分析","aria-hidden":"true"},"#"),o(" 8.基于贝叶斯的情感分析")],-1),s=[c];function n(d,i){return t(),a("div",null,s)}const f=_(r,[["render",n],["__file","8.基于贝叶斯的情感分析.html.vue"]]);export{f as default}; diff --git "a/assets/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html-npDz6nv1.js" "b/assets/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html-npDz6nv1.js" new file mode 100644 index 00000000..fff9322a --- /dev/null +++ "b/assets/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html-npDz6nv1.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-0b62f72e","path":"/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html","title":"9.网站性能优化","lang":"zh-CN","frontmatter":{"description":"9.网站性能优化","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"9.网站性能优化"}],["meta",{"property":"og:description","content":"9.网站性能优化"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"9.网站性能优化\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.02,"words":7},"filePathRelative":"personalWebsite/9.网站性能优化.md","localizedDate":"2024年1月25日","excerpt":"

9.网站性能优化

\\n","autoDesc":true}');export{e as data}; diff --git "a/assets/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html-oTS4TPN7.js" "b/assets/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html-oTS4TPN7.js" new file mode 100644 index 00000000..091965df --- /dev/null +++ "b/assets/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html-oTS4TPN7.js" @@ -0,0 +1 @@ +import{_}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c as a,a as e,d as o}from"./app-hbwtiwmf.js";const r={},c=e("h1",{id:"_9-网站性能优化",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_9-网站性能优化","aria-hidden":"true"},"#"),o(" 9.网站性能优化")],-1),s=[c];function n(d,i){return t(),a("div",null,s)}const f=_(r,[["render",n],["__file","9.网站性能优化.html.vue"]]);export{f as default}; diff --git "a/assets/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html--Lh_8vXG.js" "b/assets/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html--Lh_8vXG.js" new file mode 100644 index 00000000..ce373715 --- /dev/null +++ "b/assets/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html--Lh_8vXG.js" @@ -0,0 +1,33 @@ +import{_ as a}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as e,c as s,e as n}from"./app-hbwtiwmf.js";const r={},i=n(`

JVM调优参数

一、堆大小设置

JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可用虚拟内存限制;系统的可用物理内存限制。32位系统 下,一般限制在1.5G~2G;64为操作系统对内存无限制。我在Windows Server 2003 系统,3.5G物理内存,JDK5.0下测试,最大可设置为1478m。

典型设置:

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k
+

-Xmx3550m:设置JVM最大可用内存为3550M。
-Xms3550m:设置JVM促使内存为3550m。此值可以设置与-Xmx相同,以避免每次垃圾回收完成后JVM重新分配内存。
-Xmn2g:设置年轻代大小为2G。整个JVM内存大小=年轻代大小 + 年老代大小 + 持久代大小。持久代一般固定大小为64m,所以增大年轻代后,将会减小年老代大小。此值对系统性能影响较大,Sun官方推荐配置为整个堆的3/8。
-Xss128k: 设置每个线程的堆栈大小。JDK5.0以后每个线程堆栈大小为1M,以前每个线程堆栈大小为256K。更具应用的线程所需内存大小进行调整。在相同物理内 存下,减小这个值能生成更多的线程。但是操作系统对一个进程内的线程数还是有限制的,不能无限生成,经验值在3000~5000左右。

java -Xmx3550m -Xms3550m -Xss128k -XX:NewRatio=4 -XX:SurvivorRatio=4 -XX:MaxPermSize=16m -XX:MaxTenuringThreshold=0
+

-XX:NewRatio=4:设置年轻代(包括Eden和两个Survivor区)与年老代的比值(除去持久代)。设置为4,则年轻代与年老代所占比值为1:4,年轻代占整个堆栈的1/5
-XX:SurvivorRatio=4:设置年轻代中Eden区与Survivor区的大小比值。设置为4,则两个Survivor区与一个Eden区的比值为2:4,一个Survivor区占整个年轻代的1/6
-XX:MaxPermSize=16m:设置持久代大小为16m。
-XX:MaxTenuringThreshold=0:设置垃圾最大年龄。如果设置为0的话,则年轻代对象不经过Survivor区,直接进入年老代。对于年老代比较多的应用,可以提高效率。如果将此值设置为一个较大值,则年轻代对象会在Survivor区进行多次复制,这样可以增加对象再年轻代的存活时间,增加在年轻代即被回收的概论。

二、回收器选择

JVM给了三种选择:串行收集器、并行收集器、并发收集器,但是串行收集器只适用于小数据量的情况,所以这里的选择主要针对并行收集器和并发收集器。默认情况下,JDK5.0以前都是使用串行收集器,如果想使用其他收集器需要在启动时加入相应参数。JDK5.0以后,JVM会根据当前系统配置进行判断。

2.1 吞吐量优先的并行收集器

如上文所述,并行收集器主要以到达一定的吞吐量为目标,适用于科学技术和后台处理等。
典型配置:

java -Xmx3800m -Xms3800m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20
+

-XX:+UseParallelGC:选择垃圾收集器为并行收集器。此配置仅对年轻代有效。即上述配置下,年轻代使用并发收集,而年老代仍旧使用串行收集。
-XX:ParallelGCThreads=20:配置并行收集器的线程数,即:同时多少个线程一起进行垃圾回收。此值最好配置与处理器数目相等。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC  
+

-XX:+UseParallelOldGC:配置年老代垃圾收集方式为并行收集。JDK6.0支持对年老代并行收集。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC  -XX:MaxGCPauseMillis=100  
+

-XX:MaxGCPauseMillis=100:设置每次年轻代垃圾回收的最长时间,如果无法满足此时间,JVM会自动调整年轻代大小,以满足此值。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC  -XX:MaxGCPauseMillis=100 -XX:+UseAdaptiveSizePolicy
+

-XX:+UseAdaptiveSizePolicy:设置此选项后,并行收集器会自动选择年轻代区大小和相应的Survivor区比例,以达到目标系统规定的最低相应时间或者收集频率等,此值建议使用并行收集器时,一直打开。

2.2 响应时间优先的并发收集器

如上文所述,并发收集器主要是保证系统的响应时间,减少垃圾收集时的停顿时间。适用于应用服务器、电信领域等。
典型配置:

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
+

-XX:+UseConcMarkSweepGC:设置年老代为并发收集。测试中配置这个以后,-XX:NewRatio=4的配置失效了,原因不明。所以,此时年轻代大小最好用-Xmn设置。
-XX:+UseParNewGC:设置年轻代为并行收集。可与CMS收集同时使用。JDK5.0以上,JVM会根据系统配置自行设置,所以无需再设置此值。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseConcMarkSweepGC -XX:CMSFullGCsBeforeCompaction=5 -XX:+UseCMSCompactAtFullCollection
+

-XX:CMSFullGCsBeforeCompaction:由于并发收集器不对内存空间进行压缩、整理,所以运行一段时间以后会产生“碎片”,使得运行效率降低。此值设置运行多少次GC以后对内存空间进行压缩、整理。
-XX:+UseCMSCompactAtFullCollection:打开对年老代的压缩。可能会影响性能,但是可以消除碎片

三、辅助信息

JVM提供了大量命令行参数,打印信息,供调试使用。主要有以下一些:
-XX:+PrintGC
输出形式:[GC 118250K->113543K(130112K), 0.0094143 secs]
                [Full GC 121376K->10414K(130112K), 0.0650971 secs]

-XX:+PrintGCDetails
输出形式:[GC [DefNew: 8614K->781K(9088K), 0.0123035 secs] 118250K->113543K(130112K), 0.0124633 secs]
                [GC [DefNew: 8614K->8614K(9088K), 0.0000665 secs][Tenured: 112761K->10414K(121024K), 0.0433488 secs] 121376K->10414K(130112K), 0.0436268 secs]

-XX:+PrintGCTimeStamps -XX:+PrintGC:PrintGCTimeStamps可与上面两个混合使用
输出形式:11.851: [GC 98328K->93620K(130112K), 0.0082960 secs]
-XX:+PrintGCApplicationConcurrentTime:打印每次垃圾回收前,程序未中断的执行时间。可与上面混合使用
输出形式:Application time: 0.5291524 seconds
-XX:+PrintGCApplicationStoppedTime:打印垃圾回收期间程序暂停的时间。可与上面混合使用
输出形式:Total time for which application threads were stopped: 0.0468229 seconds
-XX:PrintHeapAtGC:打印GC前后的详细堆栈信息
输出形式:

34.702: [GC {Heap before gc invocations=7:
+ def new generation   total 55296K, used 52568K [0x1ebd0000, 0x227d0000, 0x227d0000)
+eden space 49152K,  99% used [0x1ebd0000, 0x21bce430, 0x21bd0000)
+from space 6144K,  55% used [0x221d0000, 0x22527e10, 0x227d0000)
+  to   space 6144K,   0% used [0x21bd0000, 0x21bd0000, 0x221d0000)
+ tenured generation   total 69632K, used 2696K [0x227d0000, 0x26bd0000, 0x26bd0000)
+the space 69632K,   3% used [0x227d0000, 0x22a720f8, 0x22a72200, 0x26bd0000)
+ compacting perm gen  total 8192K, used 2898K [0x26bd0000, 0x273d0000, 0x2abd0000)
+   the space 8192K,  35% used [0x26bd0000, 0x26ea4ba8, 0x26ea4c00, 0x273d0000)
+    ro space 8192K,  66% used [0x2abd0000, 0x2b12bcc0, 0x2b12be00, 0x2b3d0000)
+    rw space 12288K,  46% used [0x2b3d0000, 0x2b972060, 0x2b972200, 0x2bfd0000)
+34.735: [DefNew: 52568K->3433K(55296K), 0.0072126 secs] 55264K->6615K(124928K)Heap after gc invocations=8:
+ def new generation   total 55296K, used 3433K [0x1ebd0000, 0x227d0000, 0x227d0000)
+eden space 49152K,   0% used [0x1ebd0000, 0x1ebd0000, 0x21bd0000)
+  from space 6144K,  55% used [0x21bd0000, 0x21f2a5e8, 0x221d0000)
+  to   space 6144K,   0% used [0x221d0000, 0x221d0000, 0x227d0000)
+ tenured generation   total 69632K, used 3182K [0x227d0000, 0x26bd0000, 0x26bd0000)
+the space 69632K,   4% used [0x227d0000, 0x22aeb958, 0x22aeba00, 0x26bd0000)
+ compacting perm gen  total 8192K, used 2898K [0x26bd0000, 0x273d0000, 0x2abd0000)
+   the space 8192K,  35% used [0x26bd0000, 0x26ea4ba8, 0x26ea4c00, 0x273d0000)
+    ro space 8192K,  66% used [0x2abd0000, 0x2b12bcc0, 0x2b12be00, 0x2b3d0000)
+    rw space 12288K,  46% used [0x2b3d0000, 0x2b972060, 0x2b972200, 0x2bfd0000)
+}
+, 0.0757599 secs]
+

-Xloggc:filename:与上面几个配合使用,把相关日志信息记录到文件以便分析。
常见配置汇总

3.1 堆设置

-Xms:初始堆大小
-Xmx:最大堆大小
-XX:NewSize=n:设置年轻代大小
-XX:NewRatio=n:设置年轻代和年老代的比值。如:为3,表示年轻代与年老代比值为1:3,年轻代占整个年轻代年老代和的1/4
-XX:SurvivorRatio=n:年轻代中Eden区与两个Survivor区的比值。注意Survivor区有两个。如:3,表示Eden:Survivor=3:2,一个Survivor区占整个年轻代的1/5
-XX:MaxPermSize=n:设置持久代大小

3.2 收集器设置

-XX:+UseSerialGC:设置串行收集器
-XX:+UseParallelGC:设置并行收集器
-XX:+UseParalledlOldGC:设置并行年老代收集器
-XX:+UseConcMarkSweepGC:设置并发收集器

3.3 垃圾回收统计信息

-XX:+PrintGC
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc:filename

3.4 并行收集器设置

-XX:ParallelGCThreads=n:设置并行收集器收集时使用的CPU数。并行收集线程数。
-XX:MaxGCPauseMillis=n:设置并行收集最大暂停时间
-XX:GCTimeRatio=n:设置垃圾回收时间占程序运行时间的百分比。公式为1/(1+n)

3.5 并发收集器设置

-XX:+CMSIncrementalMode:设置为增量模式。适用于单CPU情况。
-XX:ParallelGCThreads=n:设置并发收集器年轻代收集方式为并行收集时,使用的CPU数。并行收集线程数。

四、调优总结

4.1 年轻代大小选择

响应时间优先的应用:尽可能设大,直到接近系统的最低响应时间限制(根据实际情况选择)。在此种情况下,年轻代收集发生的频率也是最小的。同时,减少到达年老代的对象。
吞吐量优先的应用:尽可能的设置大,可能到达Gbit的程度。因为对响应时间没有要求,垃圾收集可以并行进行,一般适合8CPU以上的应用。

4.2 年老代大小选择

响应时间优先的应用:年老代使用并发收集器,所以其大小需要小心设置,一般要考虑并发会话率和会话持续时间等一些参数。如果堆设置小了,可以会造成内存碎片、高回收频率以及应用暂停而使用传统的标记清除方式;如果堆大了,则需要较长的收集时间。最优化的方案,一般需要参考以下数据获得:
并发垃圾收集信息
持久代并发收集次数
传统GC信息
花在年轻代和年老代回收上的时间比例
减少年轻代和年老代花费的时间,一般会提高应用的效率
吞吐量优先的应用:一般吞吐量优先的应用都有一个很大的年轻代和一个较小的年老代。原因是,这样可以尽可能回收掉大部分短期对象,减少中期的对象,而年老代尽存放长期存活对象。

4.3 较小堆引起的碎片问题

因为年老代的并发收集器使用标记、清除算法,所以不会对堆进行压缩。当收集器回收时,他 会把相邻的空间进行合并,这样可以分配给较大的对象。但是,当堆空间较小时,运行一段时间以后,就会出现“碎片”,如果并发收集器找不到足够的空间,那么 并发收集器将会停止,然后使用传统的标记、清除方式进行回收。如果出现“碎片”,可能需要进行如下配置:
-XX:+UseCMSCompactAtFullCollection:使用并发收集器时,开启对年老代的压缩。
-XX:CMSFullGCsBeforeCompaction=0:上面配置开启的情况下,这里设置多少次Full GC后,对年老代进行压缩

`,49),l=[i];function d(p,t){return e(),s("div",null,l)}const b=a(r,[["render",d],["__file","JVM调优参数.html.vue"]]);export{b as default}; diff --git "a/assets/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html-RmR4uDpi.js" "b/assets/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html-RmR4uDpi.js" new file mode 100644 index 00000000..48bb1fe6 --- /dev/null +++ "b/assets/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html-RmR4uDpi.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-0a27b598","path":"/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html","title":"JVM调优参数","lang":"zh-CN","frontmatter":{"description":"JVM调优参数 一、堆大小设置 JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可用虚拟内存限制;系统的可用物理内存限制。32位系统 下,一般限制在1.5G~2G;64为操作系统对内存无限制。我在Windows Server 2003 系统,3.5G物理内存,JDK5.0下测试,最大可设置为1478m。 典型设置: java -Xmx3550m -Xms3550m -Xmn2g -Xss128k","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"JVM调优参数"}],["meta",{"property":"og:description","content":"JVM调优参数 一、堆大小设置 JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可用虚拟内存限制;系统的可用物理内存限制。32位系统 下,一般限制在1.5G~2G;64为操作系统对内存无限制。我在Windows Server 2003 系统,3.5G物理内存,JDK5.0下测试,最大可设置为1478m。 典型设置: java -Xmx3550m -Xms3550m -Xmn2g -Xss128k"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"JVM调优参数\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、堆大小设置","slug":"一、堆大小设置","link":"#一、堆大小设置","children":[{"level":3,"title":"典型设置:","slug":"典型设置","link":"#典型设置","children":[]}]},{"level":2,"title":"二、回收器选择","slug":"二、回收器选择","link":"#二、回收器选择","children":[{"level":3,"title":"2.1 吞吐量优先的并行收集器","slug":"_2-1-吞吐量优先的并行收集器","link":"#_2-1-吞吐量优先的并行收集器","children":[]},{"level":3,"title":"2.2 响应时间优先的并发收集器","slug":"_2-2-响应时间优先的并发收集器","link":"#_2-2-响应时间优先的并发收集器","children":[]}]},{"level":2,"title":"三、辅助信息","slug":"三、辅助信息","link":"#三、辅助信息","children":[{"level":3,"title":"3.1 堆设置","slug":"_3-1-堆设置","link":"#_3-1-堆设置","children":[]},{"level":3,"title":"3.2 收集器设置","slug":"_3-2-收集器设置","link":"#_3-2-收集器设置","children":[]},{"level":3,"title":"3.3 垃圾回收统计信息","slug":"_3-3-垃圾回收统计信息","link":"#_3-3-垃圾回收统计信息","children":[]},{"level":3,"title":"3.4 并行收集器设置","slug":"_3-4-并行收集器设置","link":"#_3-4-并行收集器设置","children":[]},{"level":3,"title":"3.5 并发收集器设置","slug":"_3-5-并发收集器设置","link":"#_3-5-并发收集器设置","children":[]}]},{"level":2,"title":"四、调优总结","slug":"四、调优总结","link":"#四、调优总结","children":[{"level":3,"title":"4.1 年轻代大小选择","slug":"_4-1-年轻代大小选择","link":"#_4-1-年轻代大小选择","children":[]},{"level":3,"title":"4.2 年老代大小选择","slug":"_4-2-年老代大小选择","link":"#_4-2-年老代大小选择","children":[]},{"level":3,"title":"4.3 较小堆引起的碎片问题","slug":"_4-3-较小堆引起的碎片问题","link":"#_4-3-较小堆引起的碎片问题","children":[]}]}],"git":{"createdTime":1706066758000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":9.13,"words":2739},"filePathRelative":"java/JVM调优参数.md","localizedDate":"2024年1月24日","excerpt":"

JVM调优参数

\\n

一、堆大小设置

\\n

JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可用虚拟内存限制;系统的可用物理内存限制。32位系统 下,一般限制在1.5G~2G;64为操作系统对内存无限制。我在Windows Server 2003 系统,3.5G物理内存,JDK5.0下测试,最大可设置为1478m。

\\n

典型设置:

\\n
java -Xmx3550m -Xms3550m -Xmn2g -Xss128k\\n
","autoDesc":true}');export{e as data}; diff --git a/assets/app-hbwtiwmf.js b/assets/app-hbwtiwmf.js new file mode 100644 index 00000000..7ef9bd19 --- /dev/null +++ b/assets/app-hbwtiwmf.js @@ -0,0 +1,369 @@ +/** +* @vue/shared v3.4.15 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function ra(e,t){const n=new Set(e.split(","));return t?l=>n.has(l.toLowerCase()):l=>n.has(l)}const Ae={},fn=[],Qe=()=>{},Hu=()=>!1,el=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),aa=e=>e.startsWith("onUpdate:"),Be=Object.assign,sa=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},zu=Object.prototype.hasOwnProperty,pe=(e,t)=>zu.call(e,t),X=Array.isArray,$n=e=>Yl(e)==="[object Map]",qu=e=>Yl(e)==="[object Set]",le=e=>typeof e=="function",se=e=>typeof e=="string",Jl=e=>typeof e=="symbol",Le=e=>e!==null&&typeof e=="object",xi=e=>(Le(e)||le(e))&&le(e.then)&&le(e.catch),Wu=Object.prototype.toString,Yl=e=>Wu.call(e),Gu=e=>Yl(e).slice(8,-1),Uu=e=>Yl(e)==="[object Object]",ia=e=>se(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Fn=ra(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Zl=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Ku=/-(\w)/g,nt=Zl(e=>e.replace(Ku,(t,n)=>n?n.toUpperCase():"")),Ju=/\B([A-Z])/g,xn=Zl(e=>e.replace(Ju,"-$1").toLowerCase()),tl=Zl(e=>e.charAt(0).toUpperCase()+e.slice(1)),fr=Zl(e=>e?`on${tl(e)}`:""),Vt=(e,t)=>!Object.is(e,t),hr=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},Yu=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Zu=e=>{const t=se(e)?Number(e):NaN;return isNaN(t)?e:t};let ts;const Li=()=>ts||(ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function oa(e){if(X(e)){const t={};for(let n=0;n{if(n){const l=n.split(Xu);l.length>1&&(t[l[0].trim()]=l[1].trim())}}),t}function ca(e){let t="";if(se(e))t=e;else if(X(e))for(let n=0;n=2))break}this._dirtyLevel<2&&(this._dirtyLevel=0),tn()}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?2:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=$t,n=Zt;try{return $t=!0,Zt=this,this._runnings++,ns(this),this.fn()}finally{ls(this),this._runnings--,Zt=n,$t=t}}stop(){var t;this.active&&(ns(this),ls(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function id(e){return e.value}function ns(e){e._trackId++,e._depsLength=0}function ls(e){if(e.deps&&e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},$l=new WeakMap,Qt=Symbol(""),$r=Symbol("");function qe(e,t,n){if($t&&Zt){let l=$l.get(e);l||$l.set(e,l=new Map);let r=l.get(n);r||l.set(n,r=Pi(()=>l.delete(n))),Ii(Zt,r)}}function xt(e,t,n,l,r,a){const s=$l.get(e);if(!s)return;let o=[];if(t==="clear")o=[...s.values()];else if(n==="length"&&X(e)){const c=Number(l);s.forEach((u,d)=>{(d==="length"||!Jl(d)&&d>=c)&&o.push(u)})}else switch(n!==void 0&&o.push(s.get(n)),t){case"add":X(e)?ia(n)&&o.push(s.get("length")):(o.push(s.get(Qt)),$n(e)&&o.push(s.get($r)));break;case"delete":X(e)||(o.push(s.get(Qt)),$n(e)&&o.push(s.get($r)));break;case"set":$n(e)&&o.push(s.get(Qt));break}da();for(const c of o)c&&Ri(c,2);pa()}function od(e,t){var n;return(n=$l.get(e))==null?void 0:n.get(t)}const cd=ra("__proto__,__v_isRef,__isVue"),Di=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Jl)),rs=ud();function ud(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const l=ce(this);for(let a=0,s=this.length;a{e[t]=function(...n){en(),da();const l=ce(this)[t].apply(this,n);return pa(),tn(),l}}),e}function dd(e){const t=ce(this);return qe(t,"has",e),t.hasOwnProperty(e)}class Mi{constructor(t=!1,n=!1){this._isReadonly=t,this._shallow=n}get(t,n,l){const r=this._isReadonly,a=this._shallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return l===(r?a?Ad:Ni:a?Vi:Fi).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(l)?t:void 0;const s=X(t);if(!r){if(s&&pe(rs,n))return Reflect.get(rs,n,l);if(n==="hasOwnProperty")return dd}const o=Reflect.get(t,n,l);return(Jl(n)?Di.has(n):cd(n))||(r||qe(t,"get",n),a)?o:Pe(o)?s&&ia(n)?o:o.value:Le(o)?r?nn(o):nl(o):o}}class $i extends Mi{constructor(t=!1){super(!1,t)}set(t,n,l,r){let a=t[n];if(!this._shallow){const c=bn(a);if(!Fl(l)&&!bn(l)&&(a=ce(a),l=ce(l)),!X(t)&&Pe(a)&&!Pe(l))return c?!1:(a.value=l,!0)}const s=X(t)&&ia(n)?Number(n)e,Ql=e=>Reflect.getPrototypeOf(e);function yl(e,t,n=!1,l=!1){e=e.__v_raw;const r=ce(e),a=ce(t);n||(Vt(t,a)&&qe(r,"get",t),qe(r,"get",a));const{has:s}=Ql(r),o=l?fa:n?ma:Gn;if(s.call(r,t))return o(e.get(t));if(s.call(r,a))return o(e.get(a));e!==r&&e.get(t)}function _l(e,t=!1){const n=this.__v_raw,l=ce(n),r=ce(e);return t||(Vt(e,r)&&qe(l,"has",e),qe(l,"has",r)),e===r?n.has(e):n.has(e)||n.has(r)}function El(e,t=!1){return e=e.__v_raw,!t&&qe(ce(e),"iterate",Qt),Reflect.get(e,"size",e)}function as(e){e=ce(e);const t=ce(this);return Ql(t).has.call(t,e)||(t.add(e),xt(t,"add",e,e)),this}function ss(e,t){t=ce(t);const n=ce(this),{has:l,get:r}=Ql(n);let a=l.call(n,e);a||(e=ce(e),a=l.call(n,e));const s=r.call(n,e);return n.set(e,t),a?Vt(t,s)&&xt(n,"set",e,t):xt(n,"add",e,t),this}function is(e){const t=ce(this),{has:n,get:l}=Ql(t);let r=n.call(t,e);r||(e=ce(e),r=n.call(t,e)),l&&l.call(t,e);const a=t.delete(e);return r&&xt(t,"delete",e,void 0),a}function os(){const e=ce(this),t=e.size!==0,n=e.clear();return t&&xt(e,"clear",void 0,void 0),n}function kl(e,t){return function(l,r){const a=this,s=a.__v_raw,o=ce(s),c=t?fa:e?ma:Gn;return!e&&qe(o,"iterate",Qt),s.forEach((u,d)=>l.call(r,c(u),c(d),a))}}function wl(e,t,n){return function(...l){const r=this.__v_raw,a=ce(r),s=$n(a),o=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,u=r[e](...l),d=n?fa:t?ma:Gn;return!t&&qe(a,"iterate",c?$r:Qt),{next(){const{value:p,done:f}=u.next();return f?{value:p,done:f}:{value:o?[d(p[0]),d(p[1])]:d(p),done:f}},[Symbol.iterator](){return this}}}}function St(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function md(){const e={get(a){return yl(this,a)},get size(){return El(this)},has:_l,add:as,set:ss,delete:is,clear:os,forEach:kl(!1,!1)},t={get(a){return yl(this,a,!1,!0)},get size(){return El(this)},has:_l,add:as,set:ss,delete:is,clear:os,forEach:kl(!1,!0)},n={get(a){return yl(this,a,!0)},get size(){return El(this,!0)},has(a){return _l.call(this,a,!0)},add:St("add"),set:St("set"),delete:St("delete"),clear:St("clear"),forEach:kl(!0,!1)},l={get(a){return yl(this,a,!0,!0)},get size(){return El(this,!0)},has(a){return _l.call(this,a,!0)},add:St("add"),set:St("set"),delete:St("delete"),clear:St("clear"),forEach:kl(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(a=>{e[a]=wl(a,!1,!1),n[a]=wl(a,!0,!1),t[a]=wl(a,!1,!0),l[a]=wl(a,!0,!0)}),[e,n,t,l]}const[gd,bd,yd,_d]=md();function ha(e,t){const n=t?e?_d:yd:e?bd:gd;return(l,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?l:Reflect.get(pe(n,r)&&r in l?n:l,r,a)}const Ed={get:ha(!1,!1)},kd={get:ha(!1,!0)},wd={get:ha(!0,!1)},Fi=new WeakMap,Vi=new WeakMap,Ni=new WeakMap,Ad=new WeakMap;function xd(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ld(e){return e.__v_skip||!Object.isExtensible(e)?0:xd(Gu(e))}function nl(e){return bn(e)?e:va(e,!1,fd,Ed,Fi)}function ji(e){return va(e,!1,vd,kd,Vi)}function nn(e){return va(e,!0,hd,wd,Ni)}function va(e,t,n,l,r){if(!Le(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const a=r.get(e);if(a)return a;const s=Ld(e);if(s===0)return e;const o=new Proxy(e,s===2?l:n);return r.set(e,o),o}function hn(e){return bn(e)?hn(e.__v_raw):!!(e&&e.__v_isReactive)}function bn(e){return!!(e&&e.__v_isReadonly)}function Fl(e){return!!(e&&e.__v_isShallow)}function Hi(e){return hn(e)||bn(e)}function ce(e){const t=e&&e.__v_raw;return t?ce(t):e}function zi(e){return Ml(e,"__v_skip",!0),e}const Gn=e=>Le(e)?nl(e):e,ma=e=>Le(e)?nn(e):e;class qi{constructor(t,n,l,r){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new ua(()=>t(this._value),()=>Vn(this,1),()=>this.dep&&Oi(this.dep)),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=l}get value(){const t=ce(this);return(!t._cacheable||t.effect.dirty)&&Vt(t._value,t._value=t.effect.run())&&Vn(t,2),ga(t),t.effect._dirtyLevel>=1&&Vn(t,1),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Td(e,t,n=!1){let l,r;const a=le(e);return a?(l=e,r=Qe):(l=e.get,r=e.set),new qi(l,r,a||!r,n)}function ga(e){$t&&Zt&&(e=ce(e),Ii(Zt,e.dep||(e.dep=Pi(()=>e.dep=void 0,e instanceof qi?e:void 0))))}function Vn(e,t=2,n){e=ce(e);const l=e.dep;l&&Ri(l,t)}function Pe(e){return!!(e&&e.__v_isRef===!0)}function J(e){return Wi(e,!1)}function lt(e){return Wi(e,!0)}function Wi(e,t){return Pe(e)?e:new Sd(e,t)}class Sd{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:ce(t),this._value=n?t:Gn(t)}get value(){return ga(this),this._value}set value(t){const n=this.__v_isShallow||Fl(t)||bn(t);t=n?t:ce(t),Vt(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Gn(t),Vn(this,2))}}function Xt(e){return Pe(e)?e.value:e}const Cd={get:(e,t,n)=>Xt(Reflect.get(e,t,n)),set:(e,t,n,l)=>{const r=e[t];return Pe(r)&&!Pe(n)?(r.value=n,!0):Reflect.set(e,t,n,l)}};function Gi(e){return hn(e)?e:new Proxy(e,Cd)}class Bd{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:n,set:l}=t(()=>ga(this),()=>Vn(this));this._get=n,this._set=l}get value(){return this._get()}set value(t){this._set(t)}}function Ui(e){return new Bd(e)}function Id(e){const t=X(e)?new Array(e.length):{};for(const n in e)t[n]=Ki(e,n);return t}class Rd{constructor(t,n,l){this._object=t,this._key=n,this._defaultValue=l,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return od(ce(this._object),this._key)}}class Od{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Ln(e,t,n){return Pe(e)?e:le(e)?new Od(e):Le(e)&&arguments.length>1?Ki(e,t,n):J(e)}function Ki(e,t,n){const l=e[t];return Pe(l)?l:new Rd(e,t,n)}/** +* @vue/runtime-core v3.4.15 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Ft(e,t,n,l){let r;try{r=l?e(...l):e()}catch(a){ll(a,t,n)}return r}function et(e,t,n,l){if(le(e)){const a=Ft(e,t,n,l);return a&&xi(a)&&a.catch(s=>{ll(s,t,n)}),a}const r=[];for(let a=0;a>>1,r=Fe[l],a=Kn(r);avt&&Fe.splice(t,1)}function $d(e){X(e)?vn.push(...e):(!Rt||!Rt.includes(e,e.allowRecurse?Kt+1:Kt))&&vn.push(e),Yi()}function cs(e,t,n=Un?vt+1:0){for(;nKn(n)-Kn(l));if(vn.length=0,Rt){Rt.push(...t);return}for(Rt=t,Kt=0;Kte.id==null?1/0:e.id,Fd=(e,t)=>{const n=Kn(e)-Kn(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function Zi(e){Fr=!1,Un=!0,Fe.sort(Fd);try{for(vt=0;vtse(h)?h.trim():h)),p&&(r=n.map(Yu))}let o,c=l[o=fr(t)]||l[o=fr(nt(t))];!c&&a&&(c=l[o=fr(xn(t))]),c&&et(c,e,6,r);const u=l[o+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[o])return;e.emitted[o]=!0,et(u,e,6,r)}}function Qi(e,t,n=!1){const l=t.emitsCache,r=l.get(e);if(r!==void 0)return r;const a=e.emits;let s={},o=!1;if(!le(e)){const c=u=>{const d=Qi(u,t,!0);d&&(o=!0,Be(s,d))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!a&&!o?(Le(e)&&l.set(e,null),null):(X(a)?a.forEach(c=>s[c]=null):Be(s,a),Le(e)&&l.set(e,s),s)}function er(e,t){return!e||!el(t)?!1:(t=t.slice(2).replace(/Once$/,""),pe(e,t[0].toLowerCase()+t.slice(1))||pe(e,xn(t))||pe(e,t))}let Xe=null,Xi=null;function Nl(e){const t=Xe;return Xe=e,Xi=e&&e.type.__scopeId||null,t}function Nd(e,t=Xe,n){if(!t||e._n)return e;const l=(...r)=>{l._d&&Es(-1);const a=Nl(t);let s;try{s=e(...r)}finally{Nl(a),l._d&&Es(1)}return s};return l._n=!0,l._c=!0,l._d=!0,l}function vr(e){const{type:t,vnode:n,proxy:l,withProxy:r,props:a,propsOptions:[s],slots:o,attrs:c,emit:u,render:d,renderCache:p,data:f,setupState:h,ctx:g,inheritAttrs:E}=e;let k,b;const L=Nl(e);try{if(n.shapeFlag&4){const T=r||l,P=T;k=it(d.call(P,T,p,a,h,f,g)),b=c}else{const T=t;k=it(T.length>1?T(a,{attrs:c,slots:o,emit:u}):T(a,null)),b=t.props?c:jd(c)}}catch(T){zn.length=0,ll(T,e,1),k=Ie(mt)}let y=k;if(b&&E!==!1){const T=Object.keys(b),{shapeFlag:P}=y;T.length&&P&7&&(s&&T.some(aa)&&(b=Hd(b,s)),y=Nt(y,b))}return n.dirs&&(y=Nt(y),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&(y.transition=n.transition),k=y,Nl(L),k}const jd=e=>{let t;for(const n in e)(n==="class"||n==="style"||el(n))&&((t||(t={}))[n]=e[n]);return t},Hd=(e,t)=>{const n={};for(const l in e)(!aa(l)||!(l.slice(9)in t))&&(n[l]=e[l]);return n};function zd(e,t,n){const{props:l,children:r,component:a}=e,{props:s,children:o,patchFlag:c}=t,u=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return l?us(l,s,u):!!s;if(c&8){const d=t.dynamicProps;for(let p=0;pe.__isSuspense;function to(e,t){t&&t.pendingBranch?X(e)?t.effects.push(...e):t.effects.push(e):$d(e)}const Kd=Symbol.for("v-scx"),Jd=()=>he(Kd);function ya(e,t){return _a(e,null,t)}const Al={};function me(e,t,n){return _a(e,t,n)}function _a(e,t,{immediate:n,deep:l,flush:r,once:a,onTrack:s,onTrigger:o}=Ae){if(t&&a){const x=t;t=(...G)=>{x(...G),P()}}const c=Oe,u=x=>l===!0?x:dn(x,l===!1?1:void 0);let d,p=!1,f=!1;if(Pe(e)?(d=()=>e.value,p=Fl(e)):hn(e)?(d=()=>u(e),p=!0):X(e)?(f=!0,p=e.some(x=>hn(x)||Fl(x)),d=()=>e.map(x=>{if(Pe(x))return x.value;if(hn(x))return u(x);if(le(x))return Ft(x,c,2)})):le(e)?t?d=()=>Ft(e,c,2):d=()=>(h&&h(),et(e,c,3,[g])):d=Qe,t&&l){const x=d;d=()=>dn(x())}let h,g=x=>{h=y.onStop=()=>{Ft(x,c,4),h=y.onStop=void 0}},E;if(sl)if(g=Qe,t?n&&et(t,c,3,[d(),f?[]:void 0,g]):d(),r==="sync"){const x=Jd();E=x.__watcherHandles||(x.__watcherHandles=[])}else return Qe;let k=f?new Array(e.length).fill(Al):Al;const b=()=>{if(!(!y.active||!y.dirty))if(t){const x=y.run();(l||p||(f?x.some((G,F)=>Vt(G,k[F])):Vt(x,k)))&&(h&&h(),et(t,c,3,[x,k===Al?void 0:f&&k[0]===Al?[]:k,g]),k=x)}else y.run()};b.allowRecurse=!!t;let L;r==="sync"?L=b:r==="post"?L=()=>He(b,c&&c.suspense):(b.pre=!0,c&&(b.id=c.uid),L=()=>Xl(b));const y=new ua(d,Qe,L),T=Si(),P=()=>{y.stop(),T&&sa(T.effects,y)};return t?n?b():k=y.run():r==="post"?He(y.run.bind(y),c&&c.suspense):y.run(),E&&E.push(P),P}function Yd(e,t,n){const l=this.proxy,r=se(e)?e.includes(".")?no(l,e):()=>l[e]:e.bind(l,l);let a;le(t)?a=t:(a=t.handler,n=t);const s=al(this),o=_a(r,a.bind(l),n);return s(),o}function no(e,t){const n=t.split(".");return()=>{let l=e;for(let r=0;r0){if(n>=t)return e;n++}if(l=l||new Set,l.has(e))return e;if(l.add(e),Pe(e))dn(e.value,t,n,l);else if(X(e))for(let r=0;r{dn(r,t,n,l)});else if(Uu(e))for(const r in e)dn(e[r],t,n,l);return e}function ht(e,t,n,l){const r=e.dirs,a=t&&t.dirs;for(let s=0;s{e.isMounted=!0}),nr(()=>{e.isUnmounting=!0}),e}const Ye=[Function,Array],ro={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ye,onEnter:Ye,onAfterEnter:Ye,onEnterCancelled:Ye,onBeforeLeave:Ye,onLeave:Ye,onAfterLeave:Ye,onLeaveCancelled:Ye,onBeforeAppear:Ye,onAppear:Ye,onAfterAppear:Ye,onAppearCancelled:Ye},Zd={name:"BaseTransition",props:ro,setup(e,{slots:t}){const n=Tn(),l=lo();let r;return()=>{const a=t.default&&Ea(t.default(),!0);if(!a||!a.length)return;let s=a[0];if(a.length>1){for(const E of a)if(E.type!==mt){s=E;break}}const o=ce(e),{mode:c}=o;if(l.isLeaving)return mr(s);const u=ps(s);if(!u)return mr(s);const d=Jn(u,o,l,n);Yn(u,d);const p=n.subTree,f=p&&ps(p);let h=!1;const{getTransitionKey:g}=u.type;if(g){const E=g();r===void 0?r=E:E!==r&&(r=E,h=!0)}if(f&&f.type!==mt&&(!Jt(u,f)||h)){const E=Jn(f,o,l,n);if(Yn(f,E),c==="out-in")return l.isLeaving=!0,E.afterLeave=()=>{l.isLeaving=!1,n.update.active!==!1&&(n.effect.dirty=!0,n.update())},mr(s);c==="in-out"&&u.type!==mt&&(E.delayLeave=(k,b,L)=>{const y=ao(l,f);y[String(f.key)]=f,k[Ot]=()=>{b(),k[Ot]=void 0,delete d.delayedLeave},d.delayedLeave=L})}return s}}},Qd=Zd;function ao(e,t){const{leavingVNodes:n}=e;let l=n.get(t.type);return l||(l=Object.create(null),n.set(t.type,l)),l}function Jn(e,t,n,l){const{appear:r,mode:a,persisted:s=!1,onBeforeEnter:o,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:p,onLeave:f,onAfterLeave:h,onLeaveCancelled:g,onBeforeAppear:E,onAppear:k,onAfterAppear:b,onAppearCancelled:L}=t,y=String(e.key),T=ao(n,e),P=(F,D)=>{F&&et(F,l,9,D)},x=(F,D)=>{const V=D[1];P(F,D),X(F)?F.every(ne=>ne.length<=1)&&V():F.length<=1&&V()},G={mode:a,persisted:s,beforeEnter(F){let D=o;if(!n.isMounted)if(r)D=E||o;else return;F[Ot]&&F[Ot](!0);const V=T[y];V&&Jt(e,V)&&V.el[Ot]&&V.el[Ot](),P(D,[F])},enter(F){let D=c,V=u,ne=d;if(!n.isMounted)if(r)D=k||c,V=b||u,ne=L||d;else return;let N=!1;const ee=F[xl]=Te=>{N||(N=!0,Te?P(ne,[F]):P(V,[F]),G.delayedLeave&&G.delayedLeave(),F[xl]=void 0)};D?x(D,[F,ee]):ee()},leave(F,D){const V=String(e.key);if(F[xl]&&F[xl](!0),n.isUnmounting)return D();P(p,[F]);let ne=!1;const N=F[Ot]=ee=>{ne||(ne=!0,D(),ee?P(g,[F]):P(h,[F]),F[Ot]=void 0,T[V]===e&&delete T[V])};T[V]=e,f?x(f,[F,N]):N()},clone(F){return Jn(F,t,n,l)}};return G}function mr(e){if(rl(e))return e=Nt(e),e.children=null,e}function ps(e){return rl(e)?e.children?e.children[0]:void 0:e}function Yn(e,t){e.shapeFlag&6&&e.component?Yn(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Ea(e,t=!1,n){let l=[],r=0;for(let a=0;a1)for(let a=0;a!!e.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function W(e){le(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:l,delay:r=200,timeout:a,suspensible:s=!0,onError:o}=e;let c=null,u,d=0;const p=()=>(d++,c=null,f()),f=()=>{let h;return c||(h=c=t().catch(g=>{if(g=g instanceof Error?g:new Error(String(g)),o)return new Promise((E,k)=>{o(g,()=>E(p()),()=>k(g),d+1)});throw g}).then(g=>h!==c&&c?c:(g&&(g.__esModule||g[Symbol.toStringTag]==="Module")&&(g=g.default),u=g,g)))};return M({name:"AsyncComponentWrapper",__asyncLoader:f,get __asyncResolved(){return u},setup(){const h=Oe;if(u)return()=>gr(u,h);const g=L=>{c=null,ll(L,h,13,!l)};if(s&&h.suspense||sl)return f().then(L=>()=>gr(L,h)).catch(L=>(g(L),()=>l?Ie(l,{error:L}):null));const E=J(!1),k=J(),b=J(!!r);return r&&setTimeout(()=>{b.value=!1},r),a!=null&&setTimeout(()=>{if(!E.value&&!k.value){const L=new Error(`Async component timed out after ${a}ms.`);g(L),k.value=L}},a),f().then(()=>{E.value=!0,h.parent&&rl(h.parent.vnode)&&(h.parent.effect.dirty=!0,Xl(h.parent.update))}).catch(L=>{g(L),k.value=L}),()=>{if(E.value&&u)return gr(u,h);if(k.value&&l)return Ie(l,{error:k.value});if(n&&!b.value)return Ie(n)}}})}function gr(e,t){const{ref:n,props:l,children:r,ce:a}=t.vnode,s=Ie(e,l,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const rl=e=>e.type.__isKeepAlive;function Xd(e,t){so(e,"a",t)}function e1(e,t){so(e,"da",t)}function so(e,t,n=Oe){const l=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(tr(t,l,n),n){let r=n.parent;for(;r&&r.parent;)rl(r.parent.vnode)&&t1(l,t,n,r),r=r.parent}}function t1(e,t,n,l){const r=tr(t,e,l,!0);lr(()=>{sa(l[t],r)},n)}function tr(e,t,n=Oe,l=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{if(n.isUnmounted)return;en();const o=al(n),c=et(t,n,e,s);return o(),tn(),c});return l?r.unshift(a):r.push(a),a}}const Lt=e=>(t,n=Oe)=>(!sl||e==="sp")&&tr(e,(...l)=>t(...l),n),n1=Lt("bm"),Ee=Lt("m"),l1=Lt("bu"),io=Lt("u"),nr=Lt("bum"),lr=Lt("um"),r1=Lt("sp"),a1=Lt("rtg"),s1=Lt("rtc");function i1(e,t=Oe){tr("ec",e,t)}const Vr=e=>e?ko(e)?xa(e)||e.proxy:Vr(e.parent):null,jn=Be(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Vr(e.parent),$root:e=>Vr(e.root),$emit:e=>e.emit,$options:e=>ka(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,Xl(e.update)}),$nextTick:e=>e.n||(e.n=ln.bind(e.proxy)),$watch:e=>Yd.bind(e)}),br=(e,t)=>e!==Ae&&!e.__isScriptSetup&&pe(e,t),o1={get({_:e},t){const{ctx:n,setupState:l,data:r,props:a,accessCache:s,type:o,appContext:c}=e;let u;if(t[0]!=="$"){const h=s[t];if(h!==void 0)switch(h){case 1:return l[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(br(l,t))return s[t]=1,l[t];if(r!==Ae&&pe(r,t))return s[t]=2,r[t];if((u=e.propsOptions[0])&&pe(u,t))return s[t]=3,a[t];if(n!==Ae&&pe(n,t))return s[t]=4,n[t];Nr&&(s[t]=0)}}const d=jn[t];let p,f;if(d)return t==="$attrs"&&qe(e,"get",t),d(e);if((p=o.__cssModules)&&(p=p[t]))return p;if(n!==Ae&&pe(n,t))return s[t]=4,n[t];if(f=c.config.globalProperties,pe(f,t))return f[t]},set({_:e},t,n){const{data:l,setupState:r,ctx:a}=e;return br(r,t)?(r[t]=n,!0):l!==Ae&&pe(l,t)?(l[t]=n,!0):pe(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:l,appContext:r,propsOptions:a}},s){let o;return!!n[s]||e!==Ae&&pe(e,s)||br(t,s)||(o=a[0])&&pe(o,s)||pe(l,s)||pe(jn,s)||pe(r.config.globalProperties,s)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:pe(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function fs(e){return X(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Nr=!0;function c1(e){const t=ka(e),n=e.proxy,l=e.ctx;Nr=!1,t.beforeCreate&&hs(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:o,provide:c,inject:u,created:d,beforeMount:p,mounted:f,beforeUpdate:h,updated:g,activated:E,deactivated:k,beforeDestroy:b,beforeUnmount:L,destroyed:y,unmounted:T,render:P,renderTracked:x,renderTriggered:G,errorCaptured:F,serverPrefetch:D,expose:V,inheritAttrs:ne,components:N,directives:ee,filters:Te}=t;if(u&&u1(u,l,null),s)for(const re in s){const K=s[re];le(K)&&(l[re]=K.bind(n))}if(r){const re=r.call(n,n);Le(re)&&(e.data=nl(re))}if(Nr=!0,a)for(const re in a){const K=a[re],at=le(K)?K.bind(n,n):le(K.get)?K.get.bind(n,n):Qe,Tt=!le(K)&&le(K.set)?K.set.bind(n):Qe,pt=_({get:at,set:Tt});Object.defineProperty(l,re,{enumerable:!0,configurable:!0,get:()=>pt.value,set:je=>pt.value=je})}if(o)for(const re in o)oo(o[re],l,n,re);if(c){const re=le(c)?c.call(n):c;Reflect.ownKeys(re).forEach(K=>{ct(K,re[K])})}d&&hs(d,e,"c");function Y(re,K){X(K)?K.forEach(at=>re(at.bind(n))):K&&re(K.bind(n))}if(Y(n1,p),Y(Ee,f),Y(l1,h),Y(io,g),Y(Xd,E),Y(e1,k),Y(i1,F),Y(s1,x),Y(a1,G),Y(nr,L),Y(lr,T),Y(r1,D),X(V))if(V.length){const re=e.exposed||(e.exposed={});V.forEach(K=>{Object.defineProperty(re,K,{get:()=>n[K],set:at=>n[K]=at})})}else e.exposed||(e.exposed={});P&&e.render===Qe&&(e.render=P),ne!=null&&(e.inheritAttrs=ne),N&&(e.components=N),ee&&(e.directives=ee)}function u1(e,t,n=Qe){X(e)&&(e=jr(e));for(const l in e){const r=e[l];let a;Le(r)?"default"in r?a=he(r.from||l,r.default,!0):a=he(r.from||l):a=he(r),Pe(a)?Object.defineProperty(t,l,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[l]=a}}function hs(e,t,n){et(X(e)?e.map(l=>l.bind(t.proxy)):e.bind(t.proxy),t,n)}function oo(e,t,n,l){const r=l.includes(".")?no(n,l):()=>n[l];if(se(e)){const a=t[e];le(a)&&me(r,a)}else if(le(e))me(r,e.bind(n));else if(Le(e))if(X(e))e.forEach(a=>oo(a,t,n,l));else{const a=le(e.handler)?e.handler.bind(n):t[e.handler];le(a)&&me(r,a,e)}}function ka(e){const t=e.type,{mixins:n,extends:l}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,o=a.get(t);let c;return o?c=o:!r.length&&!n&&!l?c=t:(c={},r.length&&r.forEach(u=>jl(c,u,s,!0)),jl(c,t,s)),Le(t)&&a.set(t,c),c}function jl(e,t,n,l=!1){const{mixins:r,extends:a}=t;a&&jl(e,a,n,!0),r&&r.forEach(s=>jl(e,s,n,!0));for(const s in t)if(!(l&&s==="expose")){const o=d1[s]||n&&n[s];e[s]=o?o(e[s],t[s]):t[s]}return e}const d1={data:vs,props:ms,emits:ms,methods:Mn,computed:Mn,beforeCreate:Ve,created:Ve,beforeMount:Ve,mounted:Ve,beforeUpdate:Ve,updated:Ve,beforeDestroy:Ve,beforeUnmount:Ve,destroyed:Ve,unmounted:Ve,activated:Ve,deactivated:Ve,errorCaptured:Ve,serverPrefetch:Ve,components:Mn,directives:Mn,watch:f1,provide:vs,inject:p1};function vs(e,t){return t?e?function(){return Be(le(e)?e.call(this,this):e,le(t)?t.call(this,this):t)}:t:e}function p1(e,t){return Mn(jr(e),jr(t))}function jr(e){if(X(e)){const t={};for(let n=0;n1)return n&&le(t)?t.call(l&&l.proxy):t}}function m1(e,t,n,l=!1){const r={},a={};Ml(a,rr,1),e.propsDefaults=Object.create(null),uo(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=l?r:ji(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function g1(e,t,n,l){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,o=ce(r),[c]=e.propsOptions;let u=!1;if((l||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let p=0;p{c=!0;const[f,h]=po(p,t,!0);Be(s,f),h&&o.push(...h)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!a&&!c)return Le(e)&&l.set(e,fn),fn;if(X(a))for(let d=0;d-1,h[1]=E<0||g-1||pe(h,"default"))&&o.push(p)}}}const u=[s,o];return Le(e)&&l.set(e,u),u}function gs(e){return e[0]!=="$"}function bs(e){const t=e&&e.toString().match(/^\s*(function|class) (\w+)/);return t?t[2]:e===null?"null":""}function ys(e,t){return bs(e)===bs(t)}function _s(e,t){return X(t)?t.findIndex(n=>ys(n,e)):le(t)&&ys(t,e)?0:-1}const fo=e=>e[0]==="_"||e==="$stable",wa=e=>X(e)?e.map(it):[it(e)],b1=(e,t,n)=>{if(t._n)return t;const l=Nd((...r)=>wa(t(...r)),n);return l._c=!1,l},ho=(e,t,n)=>{const l=e._ctx;for(const r in e){if(fo(r))continue;const a=e[r];if(le(a))t[r]=b1(r,a,l);else if(a!=null){const s=wa(a);t[r]=()=>s}}},vo=(e,t)=>{const n=wa(t);e.slots.default=()=>n},y1=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=ce(t),Ml(t,"_",n)):ho(t,e.slots={})}else e.slots={},t&&vo(e,t);Ml(e.slots,rr,1)},_1=(e,t,n)=>{const{vnode:l,slots:r}=e;let a=!0,s=Ae;if(l.shapeFlag&32){const o=t._;o?n&&o===1?a=!1:(Be(r,t),!n&&o===1&&delete r._):(a=!t.$stable,ho(t,r)),s=t}else t&&(vo(e,t),s={default:1});if(a)for(const o in r)!fo(o)&&s[o]==null&&delete r[o]};function zl(e,t,n,l,r=!1){if(X(e)){e.forEach((f,h)=>zl(f,t&&(X(t)?t[h]:t),n,l,r));return}if(Nn(l)&&!r)return;const a=l.shapeFlag&4?xa(l.component)||l.component.proxy:l.el,s=r?null:a,{i:o,r:c}=e,u=t&&t.r,d=o.refs===Ae?o.refs={}:o.refs,p=o.setupState;if(u!=null&&u!==c&&(se(u)?(d[u]=null,pe(p,u)&&(p[u]=null)):Pe(u)&&(u.value=null)),le(c))Ft(c,o,12,[s,d]);else{const f=se(c),h=Pe(c),g=e.f;if(f||h){const E=()=>{if(g){const k=f?pe(p,c)?p[c]:d[c]:c.value;r?X(k)&&sa(k,a):X(k)?k.includes(a)||k.push(a):f?(d[c]=[a],pe(p,c)&&(p[c]=d[c])):(c.value=[a],e.k&&(d[e.k]=c.value))}else f?(d[c]=s,pe(p,c)&&(p[c]=s)):h&&(c.value=s,e.k&&(d[e.k]=s))};r||g?E():(E.id=-1,He(E,n))}}}let Ct=!1;const E1=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",k1=e=>e.namespaceURI.includes("MathML"),Ll=e=>{if(E1(e))return"svg";if(k1(e))return"mathml"},Tl=e=>e.nodeType===8;function w1(e){const{mt:t,p:n,o:{patchProp:l,createText:r,nextSibling:a,parentNode:s,remove:o,insert:c,createComment:u}}=e,d=(y,T)=>{if(!T.hasChildNodes()){n(null,y,T),Vl(),T._vnode=y;return}Ct=!1,p(T.firstChild,y,null,null,null),Vl(),T._vnode=y,Ct&&console.error("Hydration completed but contains mismatches.")},p=(y,T,P,x,G,F=!1)=>{const D=Tl(y)&&y.data==="[",V=()=>E(y,T,P,x,G,D),{type:ne,ref:N,shapeFlag:ee,patchFlag:Te}=T;let Se=y.nodeType;T.el=y,Te===-2&&(F=!1,T.dynamicChildren=null);let Y=null;switch(ne){case yn:Se!==3?T.children===""?(c(T.el=r(""),s(y),y),Y=y):Y=V():(y.data!==T.children&&(Ct=!0,y.data=T.children),Y=a(y));break;case mt:L(y)?(Y=a(y),b(T.el=y.content.firstChild,y,P)):Se!==8||D?Y=V():Y=a(y);break;case Hn:if(D&&(y=a(y),Se=y.nodeType),Se===1||Se===3){Y=y;const re=!T.children.length;for(let K=0;K{F=F||!!T.dynamicChildren;const{type:D,props:V,patchFlag:ne,shapeFlag:N,dirs:ee,transition:Te}=T,Se=D==="input"||D==="option";if(Se||ne!==-1){ee&&ht(T,null,P,"created");let Y=!1;if(L(y)){Y=mo(x,Te)&&P&&P.vnode.props&&P.vnode.props.appear;const K=y.content.firstChild;Y&&Te.beforeEnter(K),b(K,y,P),T.el=y=K}if(N&16&&!(V&&(V.innerHTML||V.textContent))){let K=h(y.firstChild,T,y,P,x,G,F);for(;K;){Ct=!0;const at=K;K=K.nextSibling,o(at)}}else N&8&&y.textContent!==T.children&&(Ct=!0,y.textContent=T.children);if(V)if(Se||!F||ne&48)for(const K in V)(Se&&(K.endsWith("value")||K==="indeterminate")||el(K)&&!Fn(K)||K[0]===".")&&l(y,K,null,V[K],void 0,void 0,P);else V.onClick&&l(y,"onClick",null,V.onClick,void 0,void 0,P);let re;(re=V&&V.onVnodeBeforeMount)&&Ze(re,P,T),ee&&ht(T,null,P,"beforeMount"),((re=V&&V.onVnodeMounted)||ee||Y)&&to(()=>{re&&Ze(re,P,T),Y&&Te.enter(y),ee&&ht(T,null,P,"mounted")},x)}return y.nextSibling},h=(y,T,P,x,G,F,D)=>{D=D||!!T.dynamicChildren;const V=T.children,ne=V.length;for(let N=0;N{const{slotScopeIds:D}=T;D&&(G=G?G.concat(D):D);const V=s(y),ne=h(a(y),T,V,P,x,G,F);return ne&&Tl(ne)&&ne.data==="]"?a(T.anchor=ne):(Ct=!0,c(T.anchor=u("]"),V,ne),ne)},E=(y,T,P,x,G,F)=>{if(Ct=!0,T.el=null,F){const ne=k(y);for(;;){const N=a(y);if(N&&N!==ne)o(N);else break}}const D=a(y),V=s(y);return o(y),n(null,T,V,D,P,x,Ll(V),G),D},k=(y,T="[",P="]")=>{let x=0;for(;y;)if(y=a(y),y&&Tl(y)&&(y.data===T&&x++,y.data===P)){if(x===0)return a(y);x--}return y},b=(y,T,P)=>{const x=T.parentNode;x&&x.replaceChild(y,T);let G=P;for(;G;)G.vnode.el===T&&(G.vnode.el=G.subTree.el=y),G=G.parent},L=y=>y.nodeType===1&&y.tagName.toLowerCase()==="template";return[d,p]}const He=to;function A1(e){return x1(e,w1)}function x1(e,t){const n=Li();n.__VUE__=!0;const{insert:l,remove:r,patchProp:a,createElement:s,createText:o,createComment:c,setText:u,setElementText:d,parentNode:p,nextSibling:f,setScopeId:h=Qe,insertStaticContent:g}=e,E=(v,m,w,B=null,S=null,O=null,H=void 0,R=null,$=!!m.dynamicChildren)=>{if(v===m)return;v&&!Jt(v,m)&&(B=C(v),je(v,S,O,!0),v=null),m.patchFlag===-2&&($=!1,m.dynamicChildren=null);const{type:I,ref:q,shapeFlag:Q}=m;switch(I){case yn:k(v,m,w,B);break;case mt:b(v,m,w,B);break;case Hn:v==null&&L(m,w,B,H);break;case Ue:N(v,m,w,B,S,O,H,R,$);break;default:Q&1?P(v,m,w,B,S,O,H,R,$):Q&6?ee(v,m,w,B,S,O,H,R,$):(Q&64||Q&128)&&I.process(v,m,w,B,S,O,H,R,$,U)}q!=null&&S&&zl(q,v&&v.ref,O,m||v,!m)},k=(v,m,w,B)=>{if(v==null)l(m.el=o(m.children),w,B);else{const S=m.el=v.el;m.children!==v.children&&u(S,m.children)}},b=(v,m,w,B)=>{v==null?l(m.el=c(m.children||""),w,B):m.el=v.el},L=(v,m,w,B)=>{[v.el,v.anchor]=g(v.children,m,w,B,v.el,v.anchor)},y=({el:v,anchor:m},w,B)=>{let S;for(;v&&v!==m;)S=f(v),l(v,w,B),v=S;l(m,w,B)},T=({el:v,anchor:m})=>{let w;for(;v&&v!==m;)w=f(v),r(v),v=w;r(m)},P=(v,m,w,B,S,O,H,R,$)=>{m.type==="svg"?H="svg":m.type==="math"&&(H="mathml"),v==null?x(m,w,B,S,O,H,R,$):D(v,m,S,O,H,R,$)},x=(v,m,w,B,S,O,H,R)=>{let $,I;const{props:q,shapeFlag:Q,transition:Z,dirs:te}=v;if($=v.el=s(v.type,O,q&&q.is,q),Q&8?d($,v.children):Q&16&&F(v.children,$,null,B,S,yr(v,O),H,R),te&&ht(v,null,B,"created"),G($,v,v.scopeId,H,B),q){for(const ye in q)ye!=="value"&&!Fn(ye)&&a($,ye,null,q[ye],O,v.children,B,S,$e);"value"in q&&a($,"value",null,q.value,O),(I=q.onVnodeBeforeMount)&&Ze(I,B,v)}te&&ht(v,null,B,"beforeMount");const ae=mo(S,Z);ae&&Z.beforeEnter($),l($,m,w),((I=q&&q.onVnodeMounted)||ae||te)&&He(()=>{I&&Ze(I,B,v),ae&&Z.enter($),te&&ht(v,null,B,"mounted")},S)},G=(v,m,w,B,S)=>{if(w&&h(v,w),B)for(let O=0;O{for(let I=$;I{const R=m.el=v.el;let{patchFlag:$,dynamicChildren:I,dirs:q}=m;$|=v.patchFlag&16;const Q=v.props||Ae,Z=m.props||Ae;let te;if(w&&Gt(w,!1),(te=Z.onVnodeBeforeUpdate)&&Ze(te,w,m,v),q&&ht(m,v,w,"beforeUpdate"),w&&Gt(w,!0),I?V(v.dynamicChildren,I,R,w,B,yr(m,S),O):H||K(v,m,R,null,w,B,yr(m,S),O,!1),$>0){if($&16)ne(R,m,Q,Z,w,B,S);else if($&2&&Q.class!==Z.class&&a(R,"class",null,Z.class,S),$&4&&a(R,"style",Q.style,Z.style,S),$&8){const ae=m.dynamicProps;for(let ye=0;ye{te&&Ze(te,w,m,v),q&&ht(m,v,w,"updated")},B)},V=(v,m,w,B,S,O,H)=>{for(let R=0;R{if(w!==B){if(w!==Ae)for(const R in w)!Fn(R)&&!(R in B)&&a(v,R,w[R],null,H,m.children,S,O,$e);for(const R in B){if(Fn(R))continue;const $=B[R],I=w[R];$!==I&&R!=="value"&&a(v,R,I,$,H,m.children,S,O,$e)}"value"in B&&a(v,"value",w.value,B.value,H)}},N=(v,m,w,B,S,O,H,R,$)=>{const I=m.el=v?v.el:o(""),q=m.anchor=v?v.anchor:o("");let{patchFlag:Q,dynamicChildren:Z,slotScopeIds:te}=m;te&&(R=R?R.concat(te):te),v==null?(l(I,w,B),l(q,w,B),F(m.children||[],w,q,S,O,H,R,$)):Q>0&&Q&64&&Z&&v.dynamicChildren?(V(v.dynamicChildren,Z,w,S,O,H,R),(m.key!=null||S&&m===S.subTree)&&go(v,m,!0)):K(v,m,w,q,S,O,H,R,$)},ee=(v,m,w,B,S,O,H,R,$)=>{m.slotScopeIds=R,v==null?m.shapeFlag&512?S.ctx.activate(m,w,B,H,$):Te(m,w,B,S,O,H,$):Se(v,m,$)},Te=(v,m,w,B,S,O,H)=>{const R=v.component=D1(v,B,S);if(rl(v)&&(R.ctx.renderer=U),M1(R),R.asyncDep){if(S&&S.registerDep(R,Y),!v.el){const $=R.subTree=Ie(mt);b(null,$,m,w)}}else Y(R,v,m,w,S,O,H)},Se=(v,m,w)=>{const B=m.component=v.component;if(zd(v,m,w))if(B.asyncDep&&!B.asyncResolved){re(B,m,w);return}else B.next=m,Md(B.update),B.effect.dirty=!0,B.update();else m.el=v.el,B.vnode=m},Y=(v,m,w,B,S,O,H)=>{const R=()=>{if(v.isMounted){let{next:q,bu:Q,u:Z,parent:te,vnode:ae}=v;{const cn=bo(v);if(cn){q&&(q.el=ae.el,re(v,q,H)),cn.asyncDep.then(()=>{v.isUnmounted||R()});return}}let ye=q,we;Gt(v,!1),q?(q.el=ae.el,re(v,q,H)):q=ae,Q&&hr(Q),(we=q.props&&q.props.onVnodeBeforeUpdate)&&Ze(we,te,q,ae),Gt(v,!0);const Re=vr(v),st=v.subTree;v.subTree=Re,E(st,Re,p(st.el),C(st),v,S,O),q.el=Re.el,ye===null&&qd(v,Re.el),Z&&He(Z,S),(we=q.props&&q.props.onVnodeUpdated)&&He(()=>Ze(we,te,q,ae),S)}else{let q;const{el:Q,props:Z}=m,{bm:te,m:ae,parent:ye}=v,we=Nn(m);if(Gt(v,!1),te&&hr(te),!we&&(q=Z&&Z.onVnodeBeforeMount)&&Ze(q,ye,m),Gt(v,!0),Q&&ke){const Re=()=>{v.subTree=vr(v),ke(Q,v.subTree,v,S,null)};we?m.type.__asyncLoader().then(()=>!v.isUnmounted&&Re()):Re()}else{const Re=v.subTree=vr(v);E(null,Re,w,B,v,S,O),m.el=Re.el}if(ae&&He(ae,S),!we&&(q=Z&&Z.onVnodeMounted)){const Re=m;He(()=>Ze(q,ye,Re),S)}(m.shapeFlag&256||ye&&Nn(ye.vnode)&&ye.vnode.shapeFlag&256)&&v.a&&He(v.a,S),v.isMounted=!0,m=w=B=null}},$=v.effect=new ua(R,Qe,()=>Xl(I),v.scope),I=v.update=()=>{$.dirty&&$.run()};I.id=v.uid,Gt(v,!0),I()},re=(v,m,w)=>{m.component=v;const B=v.vnode.props;v.vnode=m,v.next=null,g1(v,m.props,B,w),_1(v,m.children,w),en(),cs(v),tn()},K=(v,m,w,B,S,O,H,R,$=!1)=>{const I=v&&v.children,q=v?v.shapeFlag:0,Q=m.children,{patchFlag:Z,shapeFlag:te}=m;if(Z>0){if(Z&128){Tt(I,Q,w,B,S,O,H,R,$);return}else if(Z&256){at(I,Q,w,B,S,O,H,R,$);return}}te&8?(q&16&&$e(I,S,O),Q!==I&&d(w,Q)):q&16?te&16?Tt(I,Q,w,B,S,O,H,R,$):$e(I,S,O,!0):(q&8&&d(w,""),te&16&&F(Q,w,B,S,O,H,R,$))},at=(v,m,w,B,S,O,H,R,$)=>{v=v||fn,m=m||fn;const I=v.length,q=m.length,Q=Math.min(I,q);let Z;for(Z=0;Zq?$e(v,S,O,!0,!1,Q):F(m,w,B,S,O,H,R,$,Q)},Tt=(v,m,w,B,S,O,H,R,$)=>{let I=0;const q=m.length;let Q=v.length-1,Z=q-1;for(;I<=Q&&I<=Z;){const te=v[I],ae=m[I]=$?Pt(m[I]):it(m[I]);if(Jt(te,ae))E(te,ae,w,null,S,O,H,R,$);else break;I++}for(;I<=Q&&I<=Z;){const te=v[Q],ae=m[Z]=$?Pt(m[Z]):it(m[Z]);if(Jt(te,ae))E(te,ae,w,null,S,O,H,R,$);else break;Q--,Z--}if(I>Q){if(I<=Z){const te=Z+1,ae=teZ)for(;I<=Q;)je(v[I],S,O,!0),I++;else{const te=I,ae=I,ye=new Map;for(I=ae;I<=Z;I++){const We=m[I]=$?Pt(m[I]):it(m[I]);We.key!=null&&ye.set(We.key,I)}let we,Re=0;const st=Z-ae+1;let cn=!1,Qa=0;const Rn=new Array(st);for(I=0;I=st){je(We,S,O,!0);continue}let ft;if(We.key!=null)ft=ye.get(We.key);else for(we=ae;we<=Z;we++)if(Rn[we-ae]===0&&Jt(We,m[we])){ft=we;break}ft===void 0?je(We,S,O,!0):(Rn[ft-ae]=I+1,ft>=Qa?Qa=ft:cn=!0,E(We,m[ft],w,null,S,O,H,R,$),Re++)}const Xa=cn?L1(Rn):fn;for(we=Xa.length-1,I=st-1;I>=0;I--){const We=ae+I,ft=m[We],es=We+1{const{el:O,type:H,transition:R,children:$,shapeFlag:I}=v;if(I&6){pt(v.component.subTree,m,w,B);return}if(I&128){v.suspense.move(m,w,B);return}if(I&64){H.move(v,m,w,U);return}if(H===Ue){l(O,m,w);for(let Q=0;Q<$.length;Q++)pt($[Q],m,w,B);l(v.anchor,m,w);return}if(H===Hn){y(v,m,w);return}if(B!==2&&I&1&&R)if(B===0)R.beforeEnter(O),l(O,m,w),He(()=>R.enter(O),S);else{const{leave:Q,delayLeave:Z,afterLeave:te}=R,ae=()=>l(O,m,w),ye=()=>{Q(O,()=>{ae(),te&&te()})};Z?Z(O,ae,ye):ye()}else l(O,m,w)},je=(v,m,w,B=!1,S=!1)=>{const{type:O,props:H,ref:R,children:$,dynamicChildren:I,shapeFlag:q,patchFlag:Q,dirs:Z}=v;if(R!=null&&zl(R,null,w,v,!0),q&256){m.ctx.deactivate(v);return}const te=q&1&&Z,ae=!Nn(v);let ye;if(ae&&(ye=H&&H.onVnodeBeforeUnmount)&&Ze(ye,m,v),q&6)bl(v.component,w,B);else{if(q&128){v.suspense.unmount(w,B);return}te&&ht(v,null,m,"beforeUnmount"),q&64?v.type.remove(v,m,w,S,U,B):I&&(O!==Ue||Q>0&&Q&64)?$e(I,m,w,!1,!0):(O===Ue&&Q&384||!S&&q&16)&&$e($,m,w),B&&sn(v)}(ae&&(ye=H&&H.onVnodeUnmounted)||te)&&He(()=>{ye&&Ze(ye,m,v),te&&ht(v,null,m,"unmounted")},w)},sn=v=>{const{type:m,el:w,anchor:B,transition:S}=v;if(m===Ue){on(w,B);return}if(m===Hn){T(v);return}const O=()=>{r(w),S&&!S.persisted&&S.afterLeave&&S.afterLeave()};if(v.shapeFlag&1&&S&&!S.persisted){const{leave:H,delayLeave:R}=S,$=()=>H(w,O);R?R(v.el,O,$):$()}else O()},on=(v,m)=>{let w;for(;v!==m;)w=f(v),r(v),v=w;r(m)},bl=(v,m,w)=>{const{bum:B,scope:S,update:O,subTree:H,um:R}=v;B&&hr(B),S.stop(),O&&(O.active=!1,je(H,v,m,w)),R&&He(R,m),He(()=>{v.isUnmounted=!0},m),m&&m.pendingBranch&&!m.isUnmounted&&v.asyncDep&&!v.asyncResolved&&v.suspenseId===m.pendingId&&(m.deps--,m.deps===0&&m.resolve())},$e=(v,m,w,B=!1,S=!1,O=0)=>{for(let H=O;Hv.shapeFlag&6?C(v.component.subTree):v.shapeFlag&128?v.suspense.next():f(v.anchor||v.el);let z=!1;const j=(v,m,w)=>{v==null?m._vnode&&je(m._vnode,null,null,!0):E(m._vnode||null,v,m,null,null,null,w),z||(z=!0,cs(),Vl(),z=!1),m._vnode=v},U={p:E,um:je,m:pt,r:sn,mt:Te,mc:F,pc:K,pbc:V,n:C,o:e};let ve,ke;return t&&([ve,ke]=t(U)),{render:j,hydrate:ve,createApp:v1(j,ve)}}function yr({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Gt({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function mo(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function go(e,t,n=!1){const l=e.children,r=t.children;if(X(l)&&X(r))for(let a=0;a>1,e[n[o]]0&&(t[l]=n[a-1]),n[a]=l)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function bo(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:bo(t)}const T1=e=>e.__isTeleport,Ue=Symbol.for("v-fgt"),yn=Symbol.for("v-txt"),mt=Symbol.for("v-cmt"),Hn=Symbol.for("v-stc"),zn=[];let ot=null;function a3(e=!1){zn.push(ot=e?null:[])}function S1(){zn.pop(),ot=zn[zn.length-1]||null}let Zn=1;function Es(e){Zn+=e}function C1(e){return e.dynamicChildren=Zn>0?ot||fn:null,S1(),Zn>0&&ot&&ot.push(e),e}function s3(e,t,n,l,r,a){return C1(_o(e,t,n,l,r,a,!0))}function zr(e){return e?e.__v_isVNode===!0:!1}function Jt(e,t){return e.type===t.type&&e.key===t.key}const rr="__vInternal",yo=({key:e})=>e??null,Dl=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?se(e)||Pe(e)||le(e)?{i:Xe,r:e,k:t,f:!!n}:e:null);function _o(e,t=null,n=null,l=0,r=null,a=e===Ue?0:1,s=!1,o=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&yo(t),ref:t&&Dl(t),scopeId:Xi,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:l,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Xe};return o?(Aa(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=se(n)?8:16),Zn>0&&!s&&ot&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&ot.push(c),c}const Ie=B1;function B1(e,t=null,n=null,l=0,r=null,a=!1){if((!e||e===Wd)&&(e=mt),zr(e)){const o=Nt(e,t,!0);return n&&Aa(o,n),Zn>0&&!a&&ot&&(o.shapeFlag&6?ot[ot.indexOf(e)]=o:ot.push(o)),o.patchFlag|=-2,o}if(j1(e)&&(e=e.__vccOpts),t){t=I1(t);let{class:o,style:c}=t;o&&!se(o)&&(t.class=ca(o)),Le(c)&&(Hi(c)&&!X(c)&&(c=Be({},c)),t.style=oa(c))}const s=se(e)?1:Ud(e)?128:T1(e)?64:Le(e)?4:le(e)?2:0;return _o(e,t,n,l,r,s,a,!0)}function I1(e){return e?Hi(e)||rr in e?Be({},e):e:null}function Nt(e,t,n=!1){const{props:l,ref:r,patchFlag:a,children:s}=e,o=t?R1(l||{},t):l;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:o,key:o&&yo(o),ref:t&&t.ref?n&&r?X(r)?r.concat(Dl(t)):[r,Dl(t)]:Dl(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ue?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Nt(e.ssContent),ssFallback:e.ssFallback&&Nt(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function Eo(e=" ",t=0){return Ie(yn,null,e,t)}function i3(e,t){const n=Ie(Hn,null,e);return n.staticCount=t,n}function it(e){return e==null||typeof e=="boolean"?Ie(mt):X(e)?Ie(Ue,null,e.slice()):typeof e=="object"?Pt(e):Ie(yn,null,String(e))}function Pt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Nt(e)}function Aa(e,t){let n=0;const{shapeFlag:l}=e;if(t==null)t=null;else if(X(t))n=16;else if(typeof t=="object")if(l&65){const r=t.default;r&&(r._c&&(r._d=!1),Aa(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!(rr in t)?t._ctx=Xe:r===3&&Xe&&(Xe.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else le(t)?(t={default:t,_ctx:Xe},n=32):(t=String(t),l&64?(n=16,t=[Eo(t)]):n=8);e.children=t,e.shapeFlag|=n}function R1(...e){const t={};for(let n=0;nOe||Xe;let ql,qr;{const e=Li(),t=(n,l)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(l),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};ql=t("__VUE_INSTANCE_SETTERS__",n=>Oe=n),qr=t("__VUE_SSR_SETTERS__",n=>sl=n)}const al=e=>{const t=Oe;return ql(e),e.scope.on(),()=>{e.scope.off(),ql(t)}},ks=()=>{Oe&&Oe.scope.off(),ql(null)};function ko(e){return e.vnode.shapeFlag&4}let sl=!1;function M1(e,t=!1){t&&qr(t);const{props:n,children:l}=e.vnode,r=ko(e);m1(e,n,r,t),y1(e,l);const a=r?$1(e,t):void 0;return t&&qr(!1),a}function $1(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=zi(new Proxy(e.ctx,o1));const{setup:l}=n;if(l){const r=e.setupContext=l.length>1?V1(e):null,a=al(e);en();const s=Ft(l,e,0,[e.props,r]);if(tn(),a(),xi(s)){if(s.then(ks,ks),t)return s.then(o=>{ws(e,o,t)}).catch(o=>{ll(o,e,0)});e.asyncDep=s}else ws(e,s,t)}else wo(e,t)}function ws(e,t,n){le(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Le(t)&&(e.setupState=Gi(t)),wo(e,n)}let As;function wo(e,t,n){const l=e.type;if(!e.render){if(!t&&As&&!l.render){const r=l.template||ka(e).template;if(r){const{isCustomElement:a,compilerOptions:s}=e.appContext.config,{delimiters:o,compilerOptions:c}=l,u=Be(Be({isCustomElement:a,delimiters:o},s),c);l.render=As(r,u)}}e.render=l.render||Qe}{const r=al(e);en();try{c1(e)}finally{tn(),r()}}}function F1(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get(t,n){return qe(e,"get","$attrs"),t[n]}}))}function V1(e){const t=n=>{e.exposed=n||{}};return{get attrs(){return F1(e)},slots:e.slots,emit:e.emit,expose:t}}function xa(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(Gi(zi(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in jn)return jn[n](e)},has(t,n){return n in t||n in jn}}))}function N1(e,t=!0){return le(e)?e.displayName||e.name:e.name||t&&e.__name}function j1(e){return le(e)&&"__vccOpts"in e}const _=(e,t)=>Td(e,t,sl);function i(e,t,n){const l=arguments.length;return l===2?Le(t)&&!X(t)?zr(t)?Ie(e,null,[t]):Ie(e,t):Ie(e,null,t):(l>3?n=Array.prototype.slice.call(arguments,2):l===3&&zr(n)&&(n=[n]),Ie(e,t,n))}const H1="3.4.15";/** +* @vue/runtime-dom v3.4.15 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/const z1="http://www.w3.org/2000/svg",q1="http://www.w3.org/1998/Math/MathML",Dt=typeof document<"u"?document:null,xs=Dt&&Dt.createElement("template"),W1={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,l)=>{const r=t==="svg"?Dt.createElementNS(z1,e):t==="mathml"?Dt.createElementNS(q1,e):Dt.createElement(e,n?{is:n}:void 0);return e==="select"&&l&&l.multiple!=null&&r.setAttribute("multiple",l.multiple),r},createText:e=>Dt.createTextNode(e),createComment:e=>Dt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Dt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,l,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{xs.innerHTML=l==="svg"?`${e}`:l==="mathml"?`${e}`:e;const o=xs.content;if(l==="svg"||l==="mathml"){const c=o.firstChild;for(;c.firstChild;)o.appendChild(c.firstChild);o.removeChild(c)}t.insertBefore(o,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Bt="transition",On="animation",_n=Symbol("_vtc"),jt=(e,{slots:t})=>i(Qd,xo(e),t);jt.displayName="Transition";const Ao={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},G1=jt.props=Be({},ro,Ao),Ut=(e,t=[])=>{X(e)?e.forEach(n=>n(...t)):e&&e(...t)},Ls=e=>e?X(e)?e.some(t=>t.length>1):e.length>1:!1;function xo(e){const t={};for(const N in e)N in Ao||(t[N]=e[N]);if(e.css===!1)return t;const{name:n="v",type:l,duration:r,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:o=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:u=s,appearToClass:d=o,leaveFromClass:p=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:h=`${n}-leave-to`}=e,g=U1(r),E=g&&g[0],k=g&&g[1],{onBeforeEnter:b,onEnter:L,onEnterCancelled:y,onLeave:T,onLeaveCancelled:P,onBeforeAppear:x=b,onAppear:G=L,onAppearCancelled:F=y}=t,D=(N,ee,Te)=>{It(N,ee?d:o),It(N,ee?u:s),Te&&Te()},V=(N,ee)=>{N._isLeaving=!1,It(N,p),It(N,h),It(N,f),ee&&ee()},ne=N=>(ee,Te)=>{const Se=N?G:L,Y=()=>D(ee,N,Te);Ut(Se,[ee,Y]),Ts(()=>{It(ee,N?c:a),Et(ee,N?d:o),Ls(Se)||Ss(ee,l,E,Y)})};return Be(t,{onBeforeEnter(N){Ut(b,[N]),Et(N,a),Et(N,s)},onBeforeAppear(N){Ut(x,[N]),Et(N,c),Et(N,u)},onEnter:ne(!1),onAppear:ne(!0),onLeave(N,ee){N._isLeaving=!0;const Te=()=>V(N,ee);Et(N,p),To(),Et(N,f),Ts(()=>{N._isLeaving&&(It(N,p),Et(N,h),Ls(T)||Ss(N,l,k,Te))}),Ut(T,[N,Te])},onEnterCancelled(N){D(N,!1),Ut(y,[N])},onAppearCancelled(N){D(N,!0),Ut(F,[N])},onLeaveCancelled(N){V(N),Ut(P,[N])}})}function U1(e){if(e==null)return null;if(Le(e))return[_r(e.enter),_r(e.leave)];{const t=_r(e);return[t,t]}}function _r(e){return Zu(e)}function Et(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[_n]||(e[_n]=new Set)).add(t)}function It(e,t){t.split(/\s+/).forEach(l=>l&&e.classList.remove(l));const n=e[_n];n&&(n.delete(t),n.size||(e[_n]=void 0))}function Ts(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let K1=0;function Ss(e,t,n,l){const r=e._endId=++K1,a=()=>{r===e._endId&&l()};if(n)return setTimeout(a,n);const{type:s,timeout:o,propCount:c}=Lo(e,t);if(!s)return l();const u=s+"end";let d=0;const p=()=>{e.removeEventListener(u,f),a()},f=h=>{h.target===e&&++d>=c&&p()};setTimeout(()=>{d(n[g]||"").split(", "),r=l(`${Bt}Delay`),a=l(`${Bt}Duration`),s=Cs(r,a),o=l(`${On}Delay`),c=l(`${On}Duration`),u=Cs(o,c);let d=null,p=0,f=0;t===Bt?s>0&&(d=Bt,p=s,f=a.length):t===On?u>0&&(d=On,p=u,f=c.length):(p=Math.max(s,u),d=p>0?s>u?Bt:On:null,f=d?d===Bt?a.length:c.length:0);const h=d===Bt&&/\b(transform|all)(,|$)/.test(l(`${Bt}Property`).toString());return{type:d,timeout:p,propCount:f,hasTransform:h}}function Cs(e,t){for(;e.lengthBs(n)+Bs(e[l])))}function Bs(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function To(){return document.body.offsetHeight}function J1(e,t,n){const l=e[_n];l&&(t=(t?[t,...l]:[...l]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Y1=Symbol("_vod"),Z1=Symbol("");function Q1(e,t,n){const l=e.style,r=l.display,a=se(n);if(n&&!a){if(t&&!se(t))for(const s in t)n[s]==null&&Wr(l,s,"");for(const s in n)Wr(l,s,n[s])}else if(a){if(t!==n){const s=l[Z1];s&&(n+=";"+s),l.cssText=n}}else t&&e.removeAttribute("style");Y1 in e&&(l.display=r)}const Is=/\s*!important$/;function Wr(e,t,n){if(X(n))n.forEach(l=>Wr(e,t,l));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const l=X1(e,t);Is.test(n)?e.setProperty(xn(l),n.replace(Is,""),"important"):e[l]=n}}const Rs=["Webkit","Moz","ms"],Er={};function X1(e,t){const n=Er[t];if(n)return n;let l=nt(t);if(l!=="filter"&&l in e)return Er[t]=l;l=tl(l);for(let r=0;rkr||(sp.then(()=>kr=0),kr=Date.now());function op(e,t){const n=l=>{if(!l._vts)l._vts=Date.now();else if(l._vts<=n.attached)return;et(cp(l,n.value),t,5,[l])};return n.value=e,n.attached=ip(),n}function cp(e,t){if(X(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(l=>r=>!r._stopped&&l&&l(r))}else return t}const Ms=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,up=(e,t,n,l,r,a,s,o,c)=>{const u=r==="svg";t==="class"?J1(e,l,u):t==="style"?Q1(e,n,l):el(t)?aa(t)||rp(e,t,n,l,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):dp(e,t,l,u))?tp(e,t,l,a,s,o,c):(t==="true-value"?e._trueValue=l:t==="false-value"&&(e._falseValue=l),ep(e,t,l,u))};function dp(e,t,n,l){if(l)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ms(t)&&le(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Ms(t)&&se(n)?!1:t in e}const So=new WeakMap,Co=new WeakMap,Wl=Symbol("_moveCb"),$s=Symbol("_enterCb"),Bo={name:"TransitionGroup",props:Be({},G1,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Tn(),l=lo();let r,a;return io(()=>{if(!r.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!mp(r[0].el,n.vnode.el,s))return;r.forEach(fp),r.forEach(hp);const o=r.filter(vp);To(),o.forEach(c=>{const u=c.el,d=u.style;Et(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const p=u[Wl]=f=>{f&&f.target!==u||(!f||/transform$/.test(f.propertyName))&&(u.removeEventListener("transitionend",p),u[Wl]=null,It(u,s))};u.addEventListener("transitionend",p)})}),()=>{const s=ce(e),o=xo(s);let c=s.tag||Ue;r=a,a=t.default?Ea(t.default()):[];for(let u=0;udelete e.mode;Bo.props;const Io=Bo;function fp(e){const t=e.el;t[Wl]&&t[Wl](),t[$s]&&t[$s]()}function hp(e){Co.set(e,e.el.getBoundingClientRect())}function vp(e){const t=So.get(e),n=Co.get(e),l=t.left-n.left,r=t.top-n.top;if(l||r){const a=e.el.style;return a.transform=a.webkitTransform=`translate(${l}px,${r}px)`,a.transitionDuration="0s",e}}function mp(e,t,n){const l=e.cloneNode(),r=e[_n];r&&r.forEach(o=>{o.split(/\s+/).forEach(c=>c&&l.classList.remove(c))}),n.split(/\s+/).forEach(o=>o&&l.classList.add(o)),l.style.display="none";const a=t.nodeType===1?t:t.parentNode;a.appendChild(l);const{hasTransform:s}=Lo(l);return a.removeChild(l),s}const gp=Be({patchProp:up},W1);let wr,Fs=!1;function bp(){return wr=Fs?wr:A1(gp),Fs=!0,wr}const yp=(...e)=>{const t=bp().createApp(...e),{mount:n}=t;return t.mount=l=>{const r=Ep(l);if(r)return n(r,!0,_p(r))},t};function _p(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Ep(e){return se(e)?document.querySelector(e):e}const kp="modulepreload",wp=function(e){return"/"+e},Vs={},A=function(t,n,l){let r=Promise.resolve();if(n&&n.length>0){const a=document.getElementsByTagName("link");r=Promise.all(n.map(s=>{if(s=wp(s),s in Vs)return;Vs[s]=!0;const o=s.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!l)for(let p=a.length-1;p>=0;p--){const f=a[p];if(f.href===s&&(!o||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${c}`))return;const d=document.createElement("link");if(d.rel=o?"stylesheet":kp,o||(d.as="script",d.crossOrigin=""),d.href=s,document.head.appendChild(d),o)return new Promise((p,f)=>{d.addEventListener("load",p),d.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${s}`)))})}))}return r.then(()=>t()).catch(a=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a})},Ap={"v-8daa1a0e":()=>A(()=>import("./index.html-T1X0V1oK.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-79fdd481":()=>A(()=>import("./home.html-H-V88rlY.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-cfe8b6c8":()=>A(()=>import("./index.html-N_67P6-s.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-02bc92be":()=>A(()=>import("./index.html-2YbHRIsG.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-2e25198a":()=>A(()=>import("./index.html-2xQqwR-V.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-71fde78e":()=>A(()=>import("./index.html-zEn3PTqR.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-580db9be":()=>A(()=>import("./devops-ping-tai.html-kDtCSXpk.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-06d5cd4c":()=>A(()=>import("./gitlab-ci.html-HyFv5Ls3.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-132efcd1":()=>A(()=>import("./jenkins-x.html-gi90zyZ8.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-1a2ca7a7":()=>A(()=>import("./tekton.html-7q40Qc0_.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-50cb12f2":()=>A(()=>import("./index.html-HoKSYW3I.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-375ccf42":()=>A(()=>import("./jvm.html-Ul6aSXYe.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-d642798c":()=>A(()=>import("./kafka.html-LwoA1S_5.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-473223ec":()=>A(()=>import("./kubernetes.html-CE5xOJPq.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-0b13f184":()=>A(()=>import("./mysql.html-lzjdbhMn.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-091223ce":()=>A(()=>import("./tiktok2023.html-VVmqvR2f.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-0a27b598":()=>A(()=>import("./JVM调优参数.html-RmR4uDpi.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-478d0de6":()=>A(()=>import("./lucene搜索原理.html-xqazIHll.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-60eda44c":()=>A(()=>import("./serverlog.html-ib9svlbN.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-399e07b6":()=>A(()=>import("./一次jvm调优过程.html-xuuwYmgp.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-660266c1":()=>A(()=>import("./内存屏障.html-YpsEGPcG.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-90f2343c":()=>A(()=>import("./在 Spring 6 中使用虚拟线程.html-ZOZveUV6.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-0b5d4df0":()=>A(()=>import("./基于kubernetes的分布式限流.html-UTI2zCNy.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-f48afbfc":()=>A(()=>import("./index.html-O3ychtCt.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-21e54510":()=>A(()=>import("./index.html-k7gT6RRu.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-57ae83ac":()=>A(()=>import("./spark on k8s operator.html-keQuD2fg.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-22e4234a":()=>A(()=>import("./2017.html-XqDiNQIB.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-1f7a720c":()=>A(()=>import("./2018.html-eRg7gPn8.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-1c10c0ce":()=>A(()=>import("./2019.html-kO5k2-yN.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-14e6315a":()=>A(()=>import("./index.html-3xocHf-h.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-258f309e":()=>A(()=>import("./index.html-xgoJibcf.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-510415f9":()=>A(()=>import("./chatgpt.html-sGHN-7nl.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-3c114a75":()=>A(()=>import("./tesla.html-ndFmDawG.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-37ac02fe":()=>A(()=>import("./1.历史与架构.html-l2oUbETx.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-523e9724":()=>A(()=>import("./10.网站重构.html-en6sDsrJ.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-65b5c81c":()=>A(()=>import("./2.Lucene的使用.html-O-sNKJ-a.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-731a76b6":()=>A(()=>import("./3.定时任务.html-bKwnUW3o.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-bea2ce1e":()=>A(()=>import("./4.日志系统.html-NM05U0dI.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-3efc517e":()=>A(()=>import("./5.小集群部署.html-BPCQb_fL.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-79ad699f":()=>A(()=>import("./6.数据库备份.html-LAUkmUJn.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-8658e60a":()=>A(()=>import("./7.那些牛逼的插件.html--pKjO7qe.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-7e9e4a32":()=>A(()=>import("./8.基于贝叶斯的情感分析.html-O9J2qs51.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-0b62f72e":()=>A(()=>import("./9.网站性能优化.html-npDz6nv1.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-525c5e4d":()=>A(()=>import("./index.html-6v5-_UpR.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-dc384366":()=>A(()=>import("./index.html-5Ud_mAI1.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-70796e0a":()=>A(()=>import("./redis缓存.html-B4MmbAQF.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-60fc7530":()=>A(()=>import("./index.html-zovaOK4R.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-04e32b44":()=>A(()=>import("./elastic-spark.html-yTkDwYPM.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-380c630d":()=>A(()=>import("./index.html-PmT0lkiJ.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-d73a9aee":()=>A(()=>import("./elasticsearch源码debug.html-G3lK-jt-.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-3f2a15ee":()=>A(()=>import("./【elasticsearch】搜索过程详解.html-2uDM3lKq.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-aa93dec0":()=>A(()=>import("./1mysql.html-iiTeieOx.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-21ba2ec8":()=>A(()=>import("./index.html-EPjOVUzU.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-3192e5a0":()=>A(()=>import("./gap锁.html-i4faTCf2.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-2675bfdc":()=>A(()=>import("./执行计划explain.html-v0f75n9M.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-0a0b7a54":()=>A(()=>import("./数据库缓存.html-D5OE_lZE.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-3706649a":()=>A(()=>import("./404.html-WhIsgby4.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-71b3ae87":()=>A(()=>import("./index.html-vgYoWX9F.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-14c69af4":()=>A(()=>import("./index.html-yuZKtvix.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-25b47c13":()=>A(()=>import("./index.html-zdhpQIq5.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-5bc93818":()=>A(()=>import("./index.html-KA0_6BkE.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-744d024e":()=>A(()=>import("./index.html-48vkkelG.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-e52c881c":()=>A(()=>import("./index.html-IZIHDPXq.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-154dc4c4":()=>A(()=>import("./index.html-XULjGA2d.js"),__vite__mapDeps([])).then(({data:e})=>e),"v-01560935":()=>A(()=>import("./index.html-P7BZhZZ3.js"),__vite__mapDeps([])).then(({data:e})=>e)},xp=JSON.parse('{"base":"/","lang":"zh-CN","title":"个人博客","description":"个人博客","head":[["script",{"data-ad-client":"ca-pub-9037099208128116","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["meta",{"name":"robots","content":"all"}],["meta",{"name":"author","content":"个人博客"}],["meta",{"http-equiv":"Cache-Control","content":"no-cache, no-store, must-revalidate"}],["meta",{"http-equiv":"Pragma","content":"no-cache"}],["meta",{"http-equiv":"Expires","content":"0"}],["meta",{"name":"keywords","content":"Java基础, 多线程, JVM, 虚拟机, 数据库, MySQL, Spring, Redis, MyBatis, 系统设计, 分布式, RPC, 高可用, 高并发"}],["meta",{"name":"description","content":"Java基础, 多线程, JVM, 虚拟机, 数据库, MySQL, Spring, Redis, MyBatis, 系统设计, 分布式, RPC, 高可用, 高并发"}],["meta",{"name":"apple-mobile-web-app-capable","content":"yes"}],["script",{},"var _hmt = _hmt || [];\\n (function() {\\n var hm = document.createElement(\\"script\\");\\n hm.src = \\"https://hm.baidu.com/hm.js?e580b8db831811a4aaf4a8f3e30034dc\\";\\n var s = document.getElementsByTagName(\\"script\\")[0]; \\n s.parentNode.insertBefore(hm, s);\\n })();"],["link",{"rel":"icon","href":"/favicon.ico"}]],"locales":{}}');var Lp=([e,t,n])=>e==="meta"&&t.name?`${e}.${t.name}`:["title","base"].includes(e)?e:e==="template"&&t.id?`${e}.${t.id}`:JSON.stringify([e,t,n]),Tp=e=>{const t=new Set,n=[];return e.forEach(l=>{const r=Lp(l);t.has(r)||(t.add(r),n.push(l))}),n},Sp=e=>e[0]==="/"?e:`/${e}`,Ro=e=>e[e.length-1]==="/"||e.endsWith(".html")?e:`${e}/`,rn=e=>/^(https?:)?\/\//.test(e),Cp=/.md((\?|#).*)?$/,Gl=(e,t="/")=>!!(rn(e)||e.startsWith("/")&&!e.startsWith(t)&&!Cp.test(e)),Oo=e=>/^[a-z][a-z0-9+.-]*:/.test(e),La=e=>Object.prototype.toString.call(e)==="[object Object]",Ta=e=>e[e.length-1]==="/"?e.slice(0,-1):e,Po=e=>e[0]==="/"?e.slice(1):e,Bp=(e,t)=>{const n=Object.keys(e).sort((l,r)=>{const a=r.split("/").length-l.split("/").length;return a!==0?a:r.length-l.length});for(const l of n)if(t.startsWith(l))return l;return"/"};const Do={"v-8daa1a0e":W(()=>A(()=>import("./index.html-bm3LruVY.js"),__vite__mapDeps([0,1]))),"v-79fdd481":W(()=>A(()=>import("./home.html-UbXL2gcY.js"),__vite__mapDeps([2,1]))),"v-cfe8b6c8":W(()=>A(()=>import("./index.html-Mm5OOXfz.js"),__vite__mapDeps([3,1]))),"v-02bc92be":W(()=>A(()=>import("./index.html-HlLxoAqK.js"),__vite__mapDeps([4,1]))),"v-2e25198a":W(()=>A(()=>import("./index.html-n0ldjUQW.js"),__vite__mapDeps([5,1]))),"v-71fde78e":W(()=>A(()=>import("./index.html-8ckAhyww.js"),__vite__mapDeps([6,1]))),"v-580db9be":W(()=>A(()=>import("./devops-ping-tai.html-QDYIdDyo.js"),__vite__mapDeps([7,1]))),"v-06d5cd4c":W(()=>A(()=>import("./gitlab-ci.html-V0G7osrF.js"),__vite__mapDeps([8,1]))),"v-132efcd1":W(()=>A(()=>import("./jenkins-x.html-erfIag1T.js"),__vite__mapDeps([9,1]))),"v-1a2ca7a7":W(()=>A(()=>import("./tekton.html-dabteeVs.js"),__vite__mapDeps([10,1]))),"v-50cb12f2":W(()=>A(()=>import("./index.html-XmG6pc7W.js"),__vite__mapDeps([11,1]))),"v-375ccf42":W(()=>A(()=>import("./jvm.html-X0c_jgVl.js"),__vite__mapDeps([12,1]))),"v-d642798c":W(()=>A(()=>import("./kafka.html-XPZSDjhE.js"),__vite__mapDeps([13,1]))),"v-473223ec":W(()=>A(()=>import("./kubernetes.html-OuCY9z9N.js"),__vite__mapDeps([14,1]))),"v-0b13f184":W(()=>A(()=>import("./mysql.html-jTFKaNE3.js"),__vite__mapDeps([15,1]))),"v-091223ce":W(()=>A(()=>import("./tiktok2023.html-T4HWHpaT.js"),__vite__mapDeps([16,1]))),"v-0a27b598":W(()=>A(()=>import("./JVM调优参数.html--Lh_8vXG.js"),__vite__mapDeps([17,1]))),"v-478d0de6":W(()=>A(()=>import("./lucene搜索原理.html-YL_BWWs1.js"),__vite__mapDeps([18,1]))),"v-60eda44c":W(()=>A(()=>import("./serverlog.html-IiWshuB0.js"),__vite__mapDeps([19,1]))),"v-399e07b6":W(()=>A(()=>import("./一次jvm调优过程.html-BEtyUgY9.js"),__vite__mapDeps([20,1]))),"v-660266c1":W(()=>A(()=>import("./内存屏障.html-5JCsVv6o.js"),__vite__mapDeps([21,1]))),"v-90f2343c":W(()=>A(()=>import("./在 Spring 6 中使用虚拟线程.html-ix-0C20g.js"),__vite__mapDeps([22,1]))),"v-0b5d4df0":W(()=>A(()=>import("./基于kubernetes的分布式限流.html-tJsMLZCo.js"),__vite__mapDeps([23,1]))),"v-f48afbfc":W(()=>A(()=>import("./index.html-oqBikOM4.js"),__vite__mapDeps([24,1]))),"v-21e54510":W(()=>A(()=>import("./index.html-Dich0-0L.js"),__vite__mapDeps([25,1]))),"v-57ae83ac":W(()=>A(()=>import("./spark on k8s operator.html-rCBkXzhV.js"),__vite__mapDeps([26,1]))),"v-22e4234a":W(()=>A(()=>import("./2017.html-AdKOrP-m.js"),__vite__mapDeps([27,1]))),"v-1f7a720c":W(()=>A(()=>import("./2018.html-AaAxXJ4o.js"),__vite__mapDeps([28,1]))),"v-1c10c0ce":W(()=>A(()=>import("./2019.html-EnqiAe59.js"),__vite__mapDeps([29,1]))),"v-14e6315a":W(()=>A(()=>import("./index.html-P1jiBi7F.js"),__vite__mapDeps([30,1]))),"v-258f309e":W(()=>A(()=>import("./index.html-94q5B7mi.js"),__vite__mapDeps([31,1]))),"v-510415f9":W(()=>A(()=>import("./chatgpt.html-iY2QZYgv.js"),__vite__mapDeps([32,1]))),"v-3c114a75":W(()=>A(()=>import("./tesla.html-2Acqdst4.js"),__vite__mapDeps([33,1]))),"v-37ac02fe":W(()=>A(()=>import("./1.历史与架构.html-piLOZJaO.js"),__vite__mapDeps([34,1]))),"v-523e9724":W(()=>A(()=>import("./10.网站重构.html-B3DJ60R6.js"),__vite__mapDeps([35,1]))),"v-65b5c81c":W(()=>A(()=>import("./2.Lucene的使用.html-dSBaVgnp.js"),__vite__mapDeps([36,1]))),"v-731a76b6":W(()=>A(()=>import("./3.定时任务.html-eD7hZxqJ.js"),__vite__mapDeps([37,1]))),"v-bea2ce1e":W(()=>A(()=>import("./4.日志系统.html-4izcXrKw.js"),__vite__mapDeps([38,1]))),"v-3efc517e":W(()=>A(()=>import("./5.小集群部署.html-giTxitnr.js"),__vite__mapDeps([39,1]))),"v-79ad699f":W(()=>A(()=>import("./6.数据库备份.html-2L7c0TUt.js"),__vite__mapDeps([40,1]))),"v-8658e60a":W(()=>A(()=>import("./7.那些牛逼的插件.html-WOroqLxh.js"),__vite__mapDeps([41,1]))),"v-7e9e4a32":W(()=>A(()=>import("./8.基于贝叶斯的情感分析.html-uHKTPHjR.js"),__vite__mapDeps([42,1]))),"v-0b62f72e":W(()=>A(()=>import("./9.网站性能优化.html-oTS4TPN7.js"),__vite__mapDeps([43,1]))),"v-525c5e4d":W(()=>A(()=>import("./index.html-bfztJVUA.js"),__vite__mapDeps([44,1]))),"v-dc384366":W(()=>A(()=>import("./index.html-IkrxIkND.js"),__vite__mapDeps([45,1]))),"v-70796e0a":W(()=>A(()=>import("./redis缓存.html-iW7cH3sc.js"),__vite__mapDeps([46,1]))),"v-60fc7530":W(()=>A(()=>import("./index.html-K26-GfV4.js"),__vite__mapDeps([47,1]))),"v-04e32b44":W(()=>A(()=>import("./elastic-spark.html-qWo0Gzw1.js"),__vite__mapDeps([48,1]))),"v-380c630d":W(()=>A(()=>import("./index.html-Kh7ogoCl.js"),__vite__mapDeps([49,1]))),"v-d73a9aee":W(()=>A(()=>import("./elasticsearch源码debug.html-LzC5N4Nu.js"),__vite__mapDeps([50,1]))),"v-3f2a15ee":W(()=>A(()=>import("./【elasticsearch】搜索过程详解.html-qP1HLlwB.js"),__vite__mapDeps([51,1]))),"v-aa93dec0":W(()=>A(()=>import("./1mysql.html-S53I0JMm.js"),__vite__mapDeps([52,1]))),"v-21ba2ec8":W(()=>A(()=>import("./index.html-lNr9aQbu.js"),__vite__mapDeps([53,1]))),"v-3192e5a0":W(()=>A(()=>import("./gap锁.html-FsDBg4Au.js"),__vite__mapDeps([54,1]))),"v-2675bfdc":W(()=>A(()=>import("./执行计划explain.html-DEhFzLaN.js"),__vite__mapDeps([55,1]))),"v-0a0b7a54":W(()=>A(()=>import("./数据库缓存.html-ELi5zypK.js"),__vite__mapDeps([56,1]))),"v-3706649a":W(()=>A(()=>import("./404.html-EORHuK9s.js"),__vite__mapDeps([57,1]))),"v-71b3ae87":W(()=>A(()=>import("./index.html-Liu-Smqv.js"),__vite__mapDeps([58,1]))),"v-14c69af4":W(()=>A(()=>import("./index.html-GFsHk5I4.js"),__vite__mapDeps([59,1]))),"v-25b47c13":W(()=>A(()=>import("./index.html-mwc9jQFp.js"),__vite__mapDeps([60,1]))),"v-5bc93818":W(()=>A(()=>import("./index.html-C3hdABea.js"),__vite__mapDeps([61,1]))),"v-744d024e":W(()=>A(()=>import("./index.html-fplo8Du9.js"),__vite__mapDeps([62,1]))),"v-e52c881c":W(()=>A(()=>import("./index.html-b505XBQM.js"),__vite__mapDeps([63,1]))),"v-154dc4c4":W(()=>A(()=>import("./index.html-TGCezLqp.js"),__vite__mapDeps([64,1]))),"v-01560935":W(()=>A(()=>import("./index.html-jiCpawhO.js"),__vite__mapDeps([65,1])))};var Ip=Symbol(""),Mo=Symbol(""),Rp=nn({key:"",path:"",title:"",lang:"",frontmatter:{},headers:[]}),ie=()=>{const e=he(Mo);if(!e)throw new Error("pageData() is called without provider.");return e},$o=Symbol(""),be=()=>{const e=he($o);if(!e)throw new Error("usePageFrontmatter() is called without provider.");return e},Fo=Symbol(""),Op=()=>{const e=he(Fo);if(!e)throw new Error("usePageHead() is called without provider.");return e},Pp=Symbol(""),Vo=Symbol(""),Sa=()=>{const e=he(Vo);if(!e)throw new Error("usePageLang() is called without provider.");return e},No=Symbol(""),Dp=()=>{const e=he(No);if(!e)throw new Error("usePageLayout() is called without provider.");return e},Mp=J(Ap),Ca=Symbol(""),yt=()=>{const e=he(Ca);if(!e)throw new Error("useRouteLocale() is called without provider.");return e},pn=J(xp),jo=()=>pn,Ho=Symbol(""),il=()=>{const e=he(Ho);if(!e)throw new Error("useSiteLocaleData() is called without provider.");return e},$p=Symbol(""),Fp="Layout",Vp="NotFound",kt=nl({resolveLayouts:e=>e.reduce((t,n)=>({...t,...n.layouts}),{}),resolvePageData:async e=>{const t=Mp.value[e];return await(t==null?void 0:t())??Rp},resolvePageFrontmatter:e=>e.frontmatter,resolvePageHead:(e,t,n)=>{const l=se(t.description)?t.description:n.description,r=[...X(t.head)?t.head:[],...n.head,["title",{},e],["meta",{name:"description",content:l}]];return Tp(r)},resolvePageHeadTitle:(e,t)=>[e.title,t.title].filter(n=>!!n).join(" | "),resolvePageLang:(e,t)=>e.lang||t.lang||"en-US",resolvePageLayout:(e,t)=>{let n;if(e.path){const l=e.frontmatter.layout;se(l)?n=l:n=Fp}else n=Vp;return t[n]},resolveRouteLocale:(e,t)=>Bp(e,t),resolveSiteLocaleData:(e,t)=>({...e,...e.locales[t]})}),ar=M({name:"ClientOnly",setup(e,t){const n=J(!1);return Ee(()=>{n.value=!0}),()=>{var l,r;return n.value?(r=(l=t.slots).default)==null?void 0:r.call(l):null}}}),zo=M({name:"Content",props:{pageKey:{type:String,required:!1,default:""}},setup(e){const t=ie(),n=_(()=>Do[e.pageKey||t.value.key]);return()=>n.value?i(n.value):i("div","404 Not Found")}}),Je=(e={})=>e,xe=e=>rn(e)?e:`/${Po(e)}`;const Np={};/*! + * vue-router v4.2.5 + * (c) 2023 Eduardo San Martin Morote + * @license MIT + */const un=typeof window<"u";function jp(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const ge=Object.assign;function Ar(e,t){const n={};for(const l in t){const r=t[l];n[l]=dt(r)?r.map(e):e(r)}return n}const qn=()=>{},dt=Array.isArray,Hp=/\/$/,zp=e=>e.replace(Hp,"");function xr(e,t,n="/"){let l,r={},a="",s="";const o=t.indexOf("#");let c=t.indexOf("?");return o=0&&(c=-1),c>-1&&(l=t.slice(0,c),a=t.slice(c+1,o>-1?o:t.length),r=e(a)),o>-1&&(l=l||t.slice(0,o),s=t.slice(o,t.length)),l=Up(l??t,n),{fullPath:l+(a&&"?")+a+s,path:l,query:r,hash:s}}function qp(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Ns(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Wp(e,t,n){const l=t.matched.length-1,r=n.matched.length-1;return l>-1&&l===r&&En(t.matched[l],n.matched[r])&&qo(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function En(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function qo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!Gp(e[n],t[n]))return!1;return!0}function Gp(e,t){return dt(e)?js(e,t):dt(t)?js(t,e):e===t}function js(e,t){return dt(t)?e.length===t.length&&e.every((n,l)=>n===t[l]):e.length===1&&e[0]===t}function Up(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),l=e.split("/"),r=l[l.length-1];(r===".."||r===".")&&l.push("");let a=n.length-1,s,o;for(s=0;s1&&a--;else break;return n.slice(0,a).join("/")+"/"+l.slice(s-(s===l.length?1:0)).join("/")}var Qn;(function(e){e.pop="pop",e.push="push"})(Qn||(Qn={}));var Wn;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Wn||(Wn={}));function Kp(e){if(!e)if(un){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),zp(e)}const Jp=/^[^#]+#/;function Yp(e,t){return e.replace(Jp,"#")+t}function Zp(e,t){const n=document.documentElement.getBoundingClientRect(),l=e.getBoundingClientRect();return{behavior:t.behavior,left:l.left-n.left-(t.left||0),top:l.top-n.top-(t.top||0)}}const sr=()=>({left:window.pageXOffset,top:window.pageYOffset});function Qp(e){let t;if("el"in e){const n=e.el,l=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?l?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=Zp(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function Hs(e,t){return(history.state?history.state.position-t:-1)+e}const Gr=new Map;function Xp(e,t){Gr.set(e,t)}function ef(e){const t=Gr.get(e);return Gr.delete(e),t}let tf=()=>location.protocol+"//"+location.host;function Wo(e,t){const{pathname:n,search:l,hash:r}=t,a=e.indexOf("#");if(a>-1){let o=r.includes(e.slice(a))?e.slice(a).length:1,c=r.slice(o);return c[0]!=="/"&&(c="/"+c),Ns(c,"")}return Ns(n,e)+l+r}function nf(e,t,n,l){let r=[],a=[],s=null;const o=({state:f})=>{const h=Wo(e,location),g=n.value,E=t.value;let k=0;if(f){if(n.value=h,t.value=f,s&&s===g){s=null;return}k=E?f.position-E.position:0}else l(h);r.forEach(b=>{b(n.value,g,{delta:k,type:Qn.pop,direction:k?k>0?Wn.forward:Wn.back:Wn.unknown})})};function c(){s=n.value}function u(f){r.push(f);const h=()=>{const g=r.indexOf(f);g>-1&&r.splice(g,1)};return a.push(h),h}function d(){const{history:f}=window;f.state&&f.replaceState(ge({},f.state,{scroll:sr()}),"")}function p(){for(const f of a)f();a=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",d)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",d,{passive:!0}),{pauseListeners:c,listen:u,destroy:p}}function zs(e,t,n,l=!1,r=!1){return{back:e,current:t,forward:n,replaced:l,position:window.history.length,scroll:r?sr():null}}function lf(e){const{history:t,location:n}=window,l={value:Wo(e,n)},r={value:t.state};r.value||a(l.value,{back:null,current:l.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(c,u,d){const p=e.indexOf("#"),f=p>-1?(n.host&&document.querySelector("base")?e:e.slice(p))+c:tf()+e+c;try{t[d?"replaceState":"pushState"](u,"",f),r.value=u}catch(h){console.error(h),n[d?"replace":"assign"](f)}}function s(c,u){const d=ge({},t.state,zs(r.value.back,c,r.value.forward,!0),u,{position:r.value.position});a(c,d,!0),l.value=c}function o(c,u){const d=ge({},r.value,t.state,{forward:c,scroll:sr()});a(d.current,d,!0);const p=ge({},zs(l.value,c,null),{position:d.position+1},u);a(c,p,!1),l.value=c}return{location:l,state:r,push:o,replace:s}}function rf(e){e=Kp(e);const t=lf(e),n=nf(e,t.state,t.location,t.replace);function l(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=ge({location:"",base:e,go:l,createHref:Yp.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}function af(e){return typeof e=="string"||e&&typeof e=="object"}function Go(e){return typeof e=="string"||typeof e=="symbol"}const wt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Uo=Symbol("");var qs;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(qs||(qs={}));function kn(e,t){return ge(new Error,{type:e,[Uo]:!0},t)}function _t(e,t){return e instanceof Error&&Uo in e&&(t==null||!!(e.type&t))}const Ws="[^/]+?",sf={sensitive:!1,strict:!1,start:!0,end:!0},of=/[.+*?^${}()[\]/\\]/g;function cf(e,t){const n=ge({},sf,t),l=[];let r=n.start?"^":"";const a=[];for(const u of e){const d=u.length?[]:[90];n.strict&&!u.length&&(r+="/");for(let p=0;pt.length?t.length===1&&t[0]===80?1:-1:0}function df(e,t){let n=0;const l=e.score,r=t.score;for(;n0&&t[t.length-1]<0}const pf={type:0,value:""},ff=/[a-zA-Z0-9_]/;function hf(e){if(!e)return[[]];if(e==="/")return[[pf]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(h){throw new Error(`ERR (${n})/"${u}": ${h}`)}let n=0,l=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let o=0,c,u="",d="";function p(){u&&(n===0?a.push({type:0,value:u}):n===1||n===2||n===3?(a.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:u,regexp:d,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function f(){u+=c}for(;o{s(L)}:qn}function s(d){if(Go(d)){const p=l.get(d);p&&(l.delete(d),n.splice(n.indexOf(p),1),p.children.forEach(s),p.alias.forEach(s))}else{const p=n.indexOf(d);p>-1&&(n.splice(p,1),d.record.name&&l.delete(d.record.name),d.children.forEach(s),d.alias.forEach(s))}}function o(){return n}function c(d){let p=0;for(;p=0&&(d.record.path!==n[p].record.path||!Ko(d,n[p]));)p++;n.splice(p,0,d),d.record.name&&!Ks(d)&&l.set(d.record.name,d)}function u(d,p){let f,h={},g,E;if("name"in d&&d.name){if(f=l.get(d.name),!f)throw kn(1,{location:d});E=f.record.name,h=ge(Us(p.params,f.keys.filter(L=>!L.optional).map(L=>L.name)),d.params&&Us(d.params,f.keys.map(L=>L.name))),g=f.stringify(h)}else if("path"in d)g=d.path,f=n.find(L=>L.re.test(g)),f&&(h=f.parse(g),E=f.record.name);else{if(f=p.name?l.get(p.name):n.find(L=>L.re.test(p.path)),!f)throw kn(1,{location:d,currentLocation:p});E=f.record.name,h=ge({},p.params,d.params),g=f.stringify(h)}const k=[];let b=f;for(;b;)k.unshift(b.record),b=b.parent;return{name:E,path:g,params:h,matched:k,meta:yf(k)}}return e.forEach(d=>a(d)),{addRoute:a,resolve:u,removeRoute:s,getRoutes:o,getRecordMatcher:r}}function Us(e,t){const n={};for(const l of t)l in e&&(n[l]=e[l]);return n}function gf(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:bf(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function bf(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const l in e.components)t[l]=typeof n=="object"?n[l]:n;return t}function Ks(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function yf(e){return e.reduce((t,n)=>ge(t,n.meta),{})}function Js(e,t){const n={};for(const l in e)n[l]=l in t?t[l]:e[l];return n}function Ko(e,t){return t.children.some(n=>n===e||Ko(e,n))}const Jo=/#/g,_f=/&/g,Ef=/\//g,kf=/=/g,wf=/\?/g,Yo=/\+/g,Af=/%5B/g,xf=/%5D/g,Zo=/%5E/g,Lf=/%60/g,Qo=/%7B/g,Tf=/%7C/g,Xo=/%7D/g,Sf=/%20/g;function Ba(e){return encodeURI(""+e).replace(Tf,"|").replace(Af,"[").replace(xf,"]")}function Cf(e){return Ba(e).replace(Qo,"{").replace(Xo,"}").replace(Zo,"^")}function Ur(e){return Ba(e).replace(Yo,"%2B").replace(Sf,"+").replace(Jo,"%23").replace(_f,"%26").replace(Lf,"`").replace(Qo,"{").replace(Xo,"}").replace(Zo,"^")}function Bf(e){return Ur(e).replace(kf,"%3D")}function If(e){return Ba(e).replace(Jo,"%23").replace(wf,"%3F")}function Rf(e){return e==null?"":If(e).replace(Ef,"%2F")}function Ul(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function Of(e){const t={};if(e===""||e==="?")return t;const l=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;ra&&Ur(a)):[l&&Ur(l)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function Pf(e){const t={};for(const n in e){const l=e[n];l!==void 0&&(t[n]=dt(l)?l.map(r=>r==null?null:""+r):l==null?l:""+l)}return t}const Df=Symbol(""),Zs=Symbol(""),ir=Symbol(""),Ia=Symbol(""),Kr=Symbol("");function Pn(){let e=[];function t(l){return e.push(l),()=>{const r=e.indexOf(l);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Mt(e,t,n,l,r){const a=l&&(l.enterCallbacks[r]=l.enterCallbacks[r]||[]);return()=>new Promise((s,o)=>{const c=p=>{p===!1?o(kn(4,{from:n,to:t})):p instanceof Error?o(p):af(p)?o(kn(2,{from:t,to:p})):(a&&l.enterCallbacks[r]===a&&typeof p=="function"&&a.push(p),s())},u=e.call(l&&l.instances[r],t,n,c);let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(p=>o(p))})}function Lr(e,t,n,l){const r=[];for(const a of e)for(const s in a.components){let o=a.components[s];if(!(t!=="beforeRouteEnter"&&!a.instances[s]))if(Mf(o)){const u=(o.__vccOpts||o)[t];u&&r.push(Mt(u,n,l,a,s))}else{let c=o();r.push(()=>c.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${s}" at "${a.path}"`));const d=jp(u)?u.default:u;a.components[s]=d;const f=(d.__vccOpts||d)[t];return f&&Mt(f,n,l,a,s)()}))}}return r}function Mf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Jr(e){const t=he(ir),n=he(Ia),l=_(()=>t.resolve(Xt(e.to))),r=_(()=>{const{matched:c}=l.value,{length:u}=c,d=c[u-1],p=n.matched;if(!d||!p.length)return-1;const f=p.findIndex(En.bind(null,d));if(f>-1)return f;const h=Qs(c[u-2]);return u>1&&Qs(d)===h&&p[p.length-1].path!==h?p.findIndex(En.bind(null,c[u-2])):f}),a=_(()=>r.value>-1&&Nf(n.params,l.value.params)),s=_(()=>r.value>-1&&r.value===n.matched.length-1&&qo(n.params,l.value.params));function o(c={}){return Vf(c)?t[Xt(e.replace)?"replace":"push"](Xt(e.to)).catch(qn):Promise.resolve()}return{route:l,href:_(()=>l.value.href),isActive:a,isExactActive:s,navigate:o}}const $f=M({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Jr,setup(e,{slots:t}){const n=nl(Jr(e)),{options:l}=he(ir),r=_(()=>({[Xs(e.activeClass,l.linkActiveClass,"router-link-active")]:n.isActive,[Xs(e.exactActiveClass,l.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&t.default(n);return e.custom?a:i("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),Ff=$f;function Vf(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Nf(e,t){for(const n in t){const l=t[n],r=e[n];if(typeof l=="string"){if(l!==r)return!1}else if(!dt(r)||r.length!==l.length||l.some((a,s)=>a!==r[s]))return!1}return!0}function Qs(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xs=(e,t,n)=>e??t??n,jf=M({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const l=he(Kr),r=_(()=>e.route||l.value),a=he(Zs,0),s=_(()=>{let u=Xt(a);const{matched:d}=r.value;let p;for(;(p=d[u])&&!p.components;)u++;return u}),o=_(()=>r.value.matched[s.value]);ct(Zs,_(()=>s.value+1)),ct(Df,o),ct(Kr,r);const c=J();return me(()=>[c.value,o.value,e.name],([u,d,p],[f,h,g])=>{d&&(d.instances[p]=u,h&&h!==d&&u&&u===f&&(d.leaveGuards.size||(d.leaveGuards=h.leaveGuards),d.updateGuards.size||(d.updateGuards=h.updateGuards))),u&&d&&(!h||!En(d,h)||!f)&&(d.enterCallbacks[p]||[]).forEach(E=>E(u))},{flush:"post"}),()=>{const u=r.value,d=e.name,p=o.value,f=p&&p.components[d];if(!f)return ei(n.default,{Component:f,route:u});const h=p.props[d],g=h?h===!0?u.params:typeof h=="function"?h(u):h:null,k=i(f,ge({},g,t,{onVnodeUnmounted:b=>{b.component.isUnmounted&&(p.instances[d]=null)},ref:c}));return ei(n.default,{Component:k,route:u})||k}}});function ei(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const ec=jf;function Hf(e){const t=mf(e.routes,e),n=e.parseQuery||Of,l=e.stringifyQuery||Ys,r=e.history,a=Pn(),s=Pn(),o=Pn(),c=lt(wt);let u=wt;un&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=Ar.bind(null,C=>""+C),p=Ar.bind(null,Rf),f=Ar.bind(null,Ul);function h(C,z){let j,U;return Go(C)?(j=t.getRecordMatcher(C),U=z):U=C,t.addRoute(U,j)}function g(C){const z=t.getRecordMatcher(C);z&&t.removeRoute(z)}function E(){return t.getRoutes().map(C=>C.record)}function k(C){return!!t.getRecordMatcher(C)}function b(C,z){if(z=ge({},z||c.value),typeof C=="string"){const m=xr(n,C,z.path),w=t.resolve({path:m.path},z),B=r.createHref(m.fullPath);return ge(m,w,{params:f(w.params),hash:Ul(m.hash),redirectedFrom:void 0,href:B})}let j;if("path"in C)j=ge({},C,{path:xr(n,C.path,z.path).path});else{const m=ge({},C.params);for(const w in m)m[w]==null&&delete m[w];j=ge({},C,{params:p(m)}),z.params=p(z.params)}const U=t.resolve(j,z),ve=C.hash||"";U.params=d(f(U.params));const ke=qp(l,ge({},C,{hash:Cf(ve),path:U.path})),v=r.createHref(ke);return ge({fullPath:ke,hash:ve,query:l===Ys?Pf(C.query):C.query||{}},U,{redirectedFrom:void 0,href:v})}function L(C){return typeof C=="string"?xr(n,C,c.value.path):ge({},C)}function y(C,z){if(u!==C)return kn(8,{from:z,to:C})}function T(C){return G(C)}function P(C){return T(ge(L(C),{replace:!0}))}function x(C){const z=C.matched[C.matched.length-1];if(z&&z.redirect){const{redirect:j}=z;let U=typeof j=="function"?j(C):j;return typeof U=="string"&&(U=U.includes("?")||U.includes("#")?U=L(U):{path:U},U.params={}),ge({query:C.query,hash:C.hash,params:"path"in U?{}:C.params},U)}}function G(C,z){const j=u=b(C),U=c.value,ve=C.state,ke=C.force,v=C.replace===!0,m=x(j);if(m)return G(ge(L(m),{state:typeof m=="object"?ge({},ve,m.state):ve,force:ke,replace:v}),z||j);const w=j;w.redirectedFrom=z;let B;return!ke&&Wp(l,U,j)&&(B=kn(16,{to:w,from:U}),pt(U,U,!0,!1)),(B?Promise.resolve(B):V(w,U)).catch(S=>_t(S)?_t(S,2)?S:Tt(S):K(S,w,U)).then(S=>{if(S){if(_t(S,2))return G(ge({replace:v},L(S.to),{state:typeof S.to=="object"?ge({},ve,S.to.state):ve,force:ke}),z||w)}else S=N(w,U,!0,v,ve);return ne(w,U,S),S})}function F(C,z){const j=y(C,z);return j?Promise.reject(j):Promise.resolve()}function D(C){const z=on.values().next().value;return z&&typeof z.runWithContext=="function"?z.runWithContext(C):C()}function V(C,z){let j;const[U,ve,ke]=zf(C,z);j=Lr(U.reverse(),"beforeRouteLeave",C,z);for(const m of U)m.leaveGuards.forEach(w=>{j.push(Mt(w,C,z))});const v=F.bind(null,C,z);return j.push(v),$e(j).then(()=>{j=[];for(const m of a.list())j.push(Mt(m,C,z));return j.push(v),$e(j)}).then(()=>{j=Lr(ve,"beforeRouteUpdate",C,z);for(const m of ve)m.updateGuards.forEach(w=>{j.push(Mt(w,C,z))});return j.push(v),$e(j)}).then(()=>{j=[];for(const m of ke)if(m.beforeEnter)if(dt(m.beforeEnter))for(const w of m.beforeEnter)j.push(Mt(w,C,z));else j.push(Mt(m.beforeEnter,C,z));return j.push(v),$e(j)}).then(()=>(C.matched.forEach(m=>m.enterCallbacks={}),j=Lr(ke,"beforeRouteEnter",C,z),j.push(v),$e(j))).then(()=>{j=[];for(const m of s.list())j.push(Mt(m,C,z));return j.push(v),$e(j)}).catch(m=>_t(m,8)?m:Promise.reject(m))}function ne(C,z,j){o.list().forEach(U=>D(()=>U(C,z,j)))}function N(C,z,j,U,ve){const ke=y(C,z);if(ke)return ke;const v=z===wt,m=un?history.state:{};j&&(U||v?r.replace(C.fullPath,ge({scroll:v&&m&&m.scroll},ve)):r.push(C.fullPath,ve)),c.value=C,pt(C,z,j,v),Tt()}let ee;function Te(){ee||(ee=r.listen((C,z,j)=>{if(!bl.listening)return;const U=b(C),ve=x(U);if(ve){G(ge(ve,{replace:!0}),U).catch(qn);return}u=U;const ke=c.value;un&&Xp(Hs(ke.fullPath,j.delta),sr()),V(U,ke).catch(v=>_t(v,12)?v:_t(v,2)?(G(v.to,U).then(m=>{_t(m,20)&&!j.delta&&j.type===Qn.pop&&r.go(-1,!1)}).catch(qn),Promise.reject()):(j.delta&&r.go(-j.delta,!1),K(v,U,ke))).then(v=>{v=v||N(U,ke,!1),v&&(j.delta&&!_t(v,8)?r.go(-j.delta,!1):j.type===Qn.pop&&_t(v,20)&&r.go(-1,!1)),ne(U,ke,v)}).catch(qn)}))}let Se=Pn(),Y=Pn(),re;function K(C,z,j){Tt(C);const U=Y.list();return U.length?U.forEach(ve=>ve(C,z,j)):console.error(C),Promise.reject(C)}function at(){return re&&c.value!==wt?Promise.resolve():new Promise((C,z)=>{Se.add([C,z])})}function Tt(C){return re||(re=!C,Te(),Se.list().forEach(([z,j])=>C?j(C):z()),Se.reset()),C}function pt(C,z,j,U){const{scrollBehavior:ve}=e;if(!un||!ve)return Promise.resolve();const ke=!j&&ef(Hs(C.fullPath,0))||(U||!j)&&history.state&&history.state.scroll||null;return ln().then(()=>ve(C,z,ke)).then(v=>v&&Qp(v)).catch(v=>K(v,C,z))}const je=C=>r.go(C);let sn;const on=new Set,bl={currentRoute:c,listening:!0,addRoute:h,removeRoute:g,hasRoute:k,getRoutes:E,resolve:b,options:e,push:T,replace:P,go:je,back:()=>je(-1),forward:()=>je(1),beforeEach:a.add,beforeResolve:s.add,afterEach:o.add,onError:Y.add,isReady:at,install(C){const z=this;C.component("RouterLink",Ff),C.component("RouterView",ec),C.config.globalProperties.$router=z,Object.defineProperty(C.config.globalProperties,"$route",{enumerable:!0,get:()=>Xt(c)}),un&&!sn&&c.value===wt&&(sn=!0,T(r.location).catch(ve=>{}));const j={};for(const ve in wt)Object.defineProperty(j,ve,{get:()=>c.value[ve],enumerable:!0});C.provide(ir,z),C.provide(Ia,ji(j)),C.provide(Kr,c);const U=C.unmount;on.add(C),C.unmount=function(){on.delete(C),on.size<1&&(u=wt,ee&&ee(),ee=null,c.value=wt,sn=!1,re=!1),U()}}};function $e(C){return C.reduce((z,j)=>z.then(()=>D(j)),Promise.resolve())}return bl}function zf(e,t){const n=[],l=[],r=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;sEn(u,o))?l.push(o):n.push(o));const c=e.matched[s];c&&(t.matched.find(u=>En(u,c))||r.push(c))}return[n,l,r]}function Me(){return he(ir)}function rt(){return he(Ia)}const ue=({name:e="",color:t="currentColor"},{slots:n})=>{var l;return i("svg",{xmlns:"http://www.w3.org/2000/svg",class:["icon",`${e}-icon`],viewBox:"0 0 1024 1024",fill:t,"aria-label":`${e} icon`},(l=n.default)==null?void 0:l.call(n))};ue.displayName="IconBase";const tc=({size:e=48,stroke:t=4,wrapper:n=!0,height:l=2*e})=>{const r=i("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,preserveAspectRatio:"xMidYMid",viewBox:"25 25 50 50"},[i("animateTransform",{attributeName:"transform",type:"rotate",dur:"2s",keyTimes:"0;1",repeatCount:"indefinite",values:"0;360"}),i("circle",{cx:"50",cy:"50",r:"20",fill:"none",stroke:"currentColor","stroke-width":t,"stroke-linecap":"round"},[i("animate",{attributeName:"stroke-dasharray",dur:"1.5s",keyTimes:"0;0.5;1",repeatCount:"indefinite",values:"1,200;90,200;1,200"}),i("animate",{attributeName:"stroke-dashoffset",dur:"1.5s",keyTimes:"0;0.5;1",repeatCount:"indefinite",values:"0;-35px;-125px"})])]);return n?i("div",{class:"loading-icon-wrapper",style:`display:flex;align-items:center;justify-content:center;height:${l}px`},r):r};tc.displayName="LoadingIcon";const nc=(e,{slots:t})=>{var n;return(n=t.default)==null?void 0:n.call(t)},Ra=(e="")=>{if(e){if(typeof e=="number")return new Date(e);const t=Date.parse(e.toString());if(!Number.isNaN(t))return new Date(t)}return null},or=(e,t)=>{let n=1;for(let l=0;l>6;return n+=n<<3,n^=n>>11,n%t},lc=Array.isArray,qf=e=>typeof e=="function",Wf=e=>typeof e=="string";var ol=e=>/^(https?:)?\/\//.test(e),Gf=/.md((\?|#).*)?$/,Uf=(e,t="/")=>!!(ol(e)||e.startsWith("/")&&!e.startsWith(t)&&!Gf.test(e)),Oa=e=>Object.prototype.toString.call(e)==="[object Object]",Kf=e=>e[e.length-1]==="/"?e.slice(0,-1):e;function Jf(){const e=J(!1);return Tn()&&Ee(()=>{e.value=!0}),e}function Yf(e){return Jf(),_(()=>!!e())}const Tr=e=>typeof e=="number",gt=e=>typeof e=="string",Ht=(e,t)=>gt(e)&&e.startsWith(t),Sl=(e,t)=>gt(e)&&e.endsWith(t),Sn=Object.entries,Zf=Object.fromEntries,bt=Object.keys,Qf=e=>(e.endsWith(".md")&&(e=`${e.slice(0,-3)}.html`),!e.endsWith("/")&&!e.endsWith(".html")&&(e=`${e}.html`),e=e.replace(/(^|\/)(?:README|index).html$/i,"$1"),e),rc=e=>{const[t,n=""]=e.split("#");return t?`${Qf(t)}${n?`#${n}`:""}`:e},ti=e=>Oa(e)&>(e.name),Xn=(e,t=!1)=>e?lc(e)?e.map(n=>gt(n)?{name:n}:ti(n)?n:null).filter(n=>n!==null):gt(e)?[{name:e}]:ti(e)?[e]:(console.error(`Expect "author" to be \`AuthorInfo[] | AuthorInfo | string[] | string ${t?"":"| false"} | undefined\`, but got`,e),[]):[],ac=(e,t)=>{if(e){if(lc(e)&&e.every(gt))return e;if(gt(e))return[e];console.error(`Expect ${t||"value"} to be \`string[] | string | undefined\`, but got`,e)}return[]},sc=e=>ac(e,"category"),ic=e=>ac(e,"tag"),Cn=e=>Ht(e,"/");let Xf=class{constructor(){this.messageElements={};const t="message-container",n=document.getElementById(t);n?this.containerElement=n:(this.containerElement=document.createElement("div"),this.containerElement.id=t,document.body.appendChild(this.containerElement))}pop(t,n=2e3){const l=document.createElement("div"),r=Date.now();return l.className="message move-in",l.innerHTML=t,this.containerElement.appendChild(l),this.messageElements[r]=l,n>0&&setTimeout(()=>{this.close(r)},n),r}close(t){if(t){const n=this.messageElements[t];n.classList.remove("move-in"),n.classList.add("move-out"),n.addEventListener("animationend",()=>{n.remove(),delete this.messageElements[t]})}else bt(this.messageElements).forEach(n=>this.close(Number(n)))}destroy(){document.body.removeChild(this.containerElement)}};const oc=/#.*$/u,eh=e=>{const t=oc.exec(e);return t?t[0]:""},ni=e=>decodeURI(e).replace(oc,"").replace(/(index)?\.html$/i,"").replace(/(README|index)?\.md$/i,""),cc=(e,t)=>{if(t===void 0)return!1;const n=ni(e.path),l=ni(t),r=eh(t);return r?r===e.hash&&(!l||n===l):n===l},th=e=>ol(e)?e:`https://github.com/${e}`,uc=e=>!ol(e)||/github\.com/.test(e)?"GitHub":/bitbucket\.org/.test(e)?"Bitbucket":/gitlab\.com/.test(e)?"GitLab":/gitee\.com/.test(e)?"Gitee":null,wn=(e,...t)=>{const n=e.resolve(...t),l=n.matched[n.matched.length-1];if(!(l!=null&&l.redirect))return n;const{redirect:r}=l,a=qf(r)?r(n):r,s=Wf(a)?{path:a}:a;return wn(e,{hash:n.hash,query:n.query,params:n.params,...s})},nh=e=>{var t;if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)&&!(e.currentTarget&&((t=e.currentTarget.getAttribute("target"))!=null&&t.match(/\b_blank\b/i))))return e.preventDefault(),!0},Ce=({to:e="",class:t="",...n},{slots:l})=>{var o;const r=Me(),a=rc(e),s=(c={})=>nh(c)?r.push(e).catch():Promise.resolve();return i("a",{...n,class:["vp-link",t],href:Ht(a,"/")?xe(a):a,onClick:s},(o=l.default)==null?void 0:o.call(l))};Ce.displayName="VPLink";const dc=()=>i(ue,{name:"github"},()=>i("path",{d:"M511.957 21.333C241.024 21.333 21.333 240.981 21.333 512c0 216.832 140.544 400.725 335.574 465.664 24.49 4.395 32.256-10.07 32.256-23.083 0-11.69.256-44.245 0-85.205-136.448 29.61-164.736-64.64-164.736-64.64-22.315-56.704-54.4-71.765-54.4-71.765-44.587-30.464 3.285-29.824 3.285-29.824 49.195 3.413 75.179 50.517 75.179 50.517 43.776 75.008 114.816 53.333 142.762 40.79 4.523-31.66 17.152-53.377 31.19-65.537-108.971-12.458-223.488-54.485-223.488-242.602 0-53.547 19.114-97.323 50.517-131.67-5.035-12.33-21.93-62.293 4.779-129.834 0 0 41.258-13.184 134.912 50.346a469.803 469.803 0 0 1 122.88-16.554c41.642.213 83.626 5.632 122.88 16.554 93.653-63.488 134.784-50.346 134.784-50.346 26.752 67.541 9.898 117.504 4.864 129.834 31.402 34.347 50.474 78.123 50.474 131.67 0 188.586-114.73 230.016-224.042 242.09 17.578 15.232 33.578 44.672 33.578 90.454v135.85c0 13.142 7.936 27.606 32.854 22.87C862.25 912.597 1002.667 728.747 1002.667 512c0-271.019-219.648-490.667-490.71-490.667z"}));dc.displayName="GitHubIcon";const pc=()=>i(ue,{name:"gitlab"},()=>i("path",{d:"M229.333 78.688C223.52 62 199.895 62 193.895 78.688L87.958 406.438h247.5c-.188 0-106.125-327.75-106.125-327.75zM33.77 571.438c-4.875 15 .563 31.687 13.313 41.25l464.812 345L87.77 406.438zm301.5-165 176.813 551.25 176.812-551.25zm655.125 165-54-165-424.312 551.25 464.812-345c12.938-9.563 18.188-26.25 13.5-41.25zM830.27 78.688c-5.812-16.688-29.437-16.688-35.437 0l-106.125 327.75h247.5z"}));pc.displayName="GitLabIcon";const fc=()=>i(ue,{name:"gitee"},()=>i("path",{d:"M512 992C246.92 992 32 777.08 32 512S246.92 32 512 32s480 214.92 480 480-214.92 480-480 480zm242.97-533.34H482.39a23.7 23.7 0 0 0-23.7 23.7l-.03 59.28c0 13.08 10.59 23.7 23.7 23.7h165.96a23.7 23.7 0 0 1 23.7 23.7v11.85a71.1 71.1 0 0 1-71.1 71.1H375.71a23.7 23.7 0 0 1-23.7-23.7V423.11a71.1 71.1 0 0 1 71.1-71.1h331.8a23.7 23.7 0 0 0 23.7-23.7l.06-59.25a23.73 23.73 0 0 0-23.7-23.73H423.11a177.78 177.78 0 0 0-177.78 177.75v331.83c0 13.08 10.62 23.7 23.7 23.7h349.62a159.99 159.99 0 0 0 159.99-159.99V482.33a23.7 23.7 0 0 0-23.7-23.7z"}));fc.displayName="GiteeIcon";const hc=()=>i(ue,{name:"bitbucket"},()=>i("path",{d:"M575.256 490.862c6.29 47.981-52.005 85.723-92.563 61.147-45.714-20.004-45.714-92.562-1.133-113.152 38.29-23.442 93.696 7.424 93.696 52.005zm63.451-11.996c-10.276-81.152-102.29-134.839-177.152-101.156-47.433 21.138-79.433 71.424-77.129 124.562 2.853 69.705 69.157 126.866 138.862 120.576S647.3 548.571 638.708 478.83zm136.558-309.723c-25.161-33.134-67.986-38.839-105.728-45.13-106.862-17.151-216.576-17.7-323.438 1.134-35.438 5.706-75.447 11.996-97.719 43.996 36.572 34.304 88.576 39.424 135.424 45.129 84.553 10.862 171.447 11.447 256 .585 47.433-5.705 99.987-10.276 135.424-45.714zm32.585 591.433c-16.018 55.99-6.839 131.438-66.304 163.986-102.29 56.576-226.304 62.867-338.87 42.862-59.43-10.862-129.135-29.696-161.72-85.723-14.3-54.858-23.442-110.848-32.585-166.84l3.438-9.142 10.276-5.157c170.277 112.567 408.576 112.567 579.438 0 26.844 8.01 6.84 40.558 6.29 60.014zm103.424-549.157c-19.42 125.148-41.728 249.71-63.415 374.272-6.29 36.572-41.728 57.162-71.424 72.558-106.862 53.724-231.424 62.866-348.562 50.286-79.433-8.558-160.585-29.696-225.134-79.433-30.28-23.443-30.28-63.415-35.986-97.134-20.005-117.138-42.862-234.277-57.161-352.585 6.839-51.42 64.585-73.728 107.447-89.71 57.16-21.138 118.272-30.866 178.87-36.571 129.134-12.58 261.157-8.01 386.304 28.562 44.581 13.13 92.563 31.415 122.844 69.705 13.714 17.7 9.143 40.01 6.29 60.014z"}));hc.displayName="BitbucketIcon";const vc=()=>i(ue,{name:"source"},()=>i("path",{d:"M601.92 475.2c0 76.428-8.91 83.754-28.512 99.594-14.652 11.88-43.956 14.058-78.012 16.434-18.81 1.386-40.392 2.97-62.172 6.534-18.612 2.97-36.432 9.306-53.064 17.424V299.772c37.818-21.978 63.36-62.766 63.36-109.692 0-69.894-56.826-126.72-126.72-126.72S190.08 120.186 190.08 190.08c0 46.926 25.542 87.714 63.36 109.692v414.216c-37.818 21.978-63.36 62.766-63.36 109.692 0 69.894 56.826 126.72 126.72 126.72s126.72-56.826 126.72-126.72c0-31.086-11.286-59.598-29.7-81.576 13.266-9.504 27.522-17.226 39.996-19.206 16.038-2.574 32.868-3.762 50.688-5.148 48.312-3.366 103.158-7.326 148.896-44.55 61.182-49.698 74.25-103.158 75.24-187.902V475.2h-126.72zM316.8 126.72c34.848 0 63.36 28.512 63.36 63.36s-28.512 63.36-63.36 63.36-63.36-28.512-63.36-63.36 28.512-63.36 63.36-63.36zm0 760.32c-34.848 0-63.36-28.512-63.36-63.36s28.512-63.36 63.36-63.36 63.36 28.512 63.36 63.36-28.512 63.36-63.36 63.36zM823.68 158.4h-95.04V63.36h-126.72v95.04h-95.04v126.72h95.04v95.04h126.72v-95.04h95.04z"}));vc.displayName="SourceIcon";const ut=(e,t)=>{var l;const n=(l=(t==null?void 0:t._instance)||Tn())==null?void 0:l.appContext.components;return n?e in n||nt(e)in n||tl(nt(e))in n:!1},lh=()=>Yf(()=>typeof window<"u"&&window.navigator&&"userAgent"in window.navigator),rh=()=>{const e=lh();return _(()=>e.value&&/\b(?:Android|iPhone)/i.test(navigator.userAgent))},Bn=e=>{const t=yt();return _(()=>e[t.value])},mc=({type:e="info",text:t="",vertical:n,color:l},{slots:r})=>{var a;return i("span",{class:["vp-badge",e,{diy:l}],style:{verticalAlign:n??!1,backgroundColor:l??!1}},((a=r.default)==null?void 0:a.call(r))||t)};mc.displayName="Badge";var ah=M({name:"FontIcon",props:{icon:{type:String,default:""},color:{type:String,default:""},size:{type:[String,Number],default:""}},setup(e){const t=_(()=>{const l=["font-icon icon"],r=`${e.icon}`;return l.push(r),l}),n=_(()=>{const l={};return e.color&&(l.color=e.color),e.size&&(l["font-size"]=Number.isNaN(Number(e.size))?e.size:`${e.size}px`),bt(l).length?l:null});return()=>e.icon?i("span",{key:e.icon,class:t.value,style:n.value}):null}});function li(e,t){var n;const l=lt();return ya(()=>{l.value=e()},{...t,flush:(n=t==null?void 0:t.flush)!=null?n:"sync"}),nn(l)}function Pa(e,t){let n,l,r;const a=J(!0),s=()=>{a.value=!0,r()};me(e,s,{flush:"sync"});const o=typeof t=="function"?t:t.get,c=typeof t=="function"?void 0:t.set,u=Ui((d,p)=>(l=d,r=p,{get(){return a.value&&(n=o(),a.value=!1),l(),n},set(f){c==null||c(f)}}));return Object.isExtensible(u)&&(u.trigger=s),u}function In(e){return Si()?(sd(e),!0):!1}function tt(e){return typeof e=="function"?e():Xt(e)}const cl=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const sh=Object.prototype.toString,ih=e=>sh.call(e)==="[object Object]",Kl=()=>{},ri=oh();function oh(){var e,t;return cl&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function gc(e,t){function n(...l){return new Promise((r,a)=>{Promise.resolve(e(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})).then(r).catch(a)})}return n}const bc=e=>e();function ch(e,t=!0,n=!0,l=!1){let r=0,a,s=!0,o=Kl,c;const u=()=>{a&&(clearTimeout(a),a=void 0,o(),o=Kl)};return p=>{const f=tt(e),h=Date.now()-r,g=()=>c=p();return u(),f<=0?(r=Date.now(),g()):(h>f&&(n||!s)?(r=Date.now(),g()):t&&(c=new Promise((E,k)=>{o=l?k:E,a=setTimeout(()=>{r=Date.now(),s=!0,E(g()),u()},Math.max(0,f-h))})),!n&&!a&&(a=setTimeout(()=>s=!0,f)),s=!1,c)}}function uh(e=bc){const t=J(!0);function n(){t.value=!1}function l(){t.value=!0}const r=(...a)=>{t.value&&e(...a)};return{isActive:nn(t),pause:n,resume:l,eventFilter:r}}function dh(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const l=t;t=void 0,l&&await l},n}function ph(e){return e||Tn()}function fh(...e){if(e.length!==1)return Ln(...e);const t=e[0];return typeof t=="function"?nn(Ui(()=>({get:t,set:Kl}))):J(t)}function hh(e,t=200,n=!1,l=!0,r=!1){return gc(ch(t,n,l,r),e)}function vh(e,t,n={}){const{eventFilter:l=bc,...r}=n;return me(e,gc(l,t),r)}function mh(e,t,n={}){const{eventFilter:l,...r}=n,{eventFilter:a,pause:s,resume:o,isActive:c}=uh(l);return{stop:vh(e,t,{...r,eventFilter:a}),pause:s,resume:o,isActive:c}}function Da(e,t=!0,n){ph()?Ee(e,n):t?e():ln(e)}function gh(e,t,n={}){const{immediate:l=!0}=n,r=J(!1);let a=null;function s(){a&&(clearTimeout(a),a=null)}function o(){r.value=!1,s()}function c(...u){s(),r.value=!0,a=setTimeout(()=>{r.value=!1,a=null,e(...u)},tt(t))}return l&&(r.value=!0,cl&&c()),In(o),{isPending:nn(r),start:c,stop:o}}function ai(e=!1,t={}){const{truthyValue:n=!0,falsyValue:l=!1}=t,r=Pe(e),a=J(e);function s(o){if(arguments.length)return a.value=o,a.value;{const c=tt(n);return a.value=a.value===c?tt(l):c,a.value}}return r?s:[a,s]}function At(e){var t;const n=tt(e);return(t=n==null?void 0:n.$el)!=null?t:n}const zt=cl?window:void 0,bh=cl?window.document:void 0,yc=cl?window.navigator:void 0;function De(...e){let t,n,l,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,l,r]=e,t=zt):[t,n,l,r]=e,!t)return Kl;Array.isArray(n)||(n=[n]),Array.isArray(l)||(l=[l]);const a=[],s=()=>{a.forEach(d=>d()),a.length=0},o=(d,p,f,h)=>(d.addEventListener(p,f,h),()=>d.removeEventListener(p,f,h)),c=me(()=>[At(t),tt(r)],([d,p])=>{if(s(),!d)return;const f=ih(p)?{...p}:p;a.push(...n.flatMap(h=>l.map(g=>o(d,h,g,f))))},{immediate:!0,flush:"post"}),u=()=>{c(),s()};return In(u),u}function yh(){const e=J(!1);return Tn()&&Ee(()=>{e.value=!0}),e}function ul(e){const t=yh();return _(()=>(t.value,!!e()))}function _c(e,t={}){const{window:n=zt}=t,l=ul(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let r;const a=J(!1),s=u=>{a.value=u.matches},o=()=>{r&&("removeEventListener"in r?r.removeEventListener("change",s):r.removeListener(s))},c=ya(()=>{l.value&&(o(),r=n.matchMedia(tt(e)),"addEventListener"in r?r.addEventListener("change",s):r.addListener(s),a.value=r.matches)});return In(()=>{c(),o(),r=void 0}),a}function si(e,t={}){const{controls:n=!1,navigator:l=yc}=t,r=ul(()=>l&&"permissions"in l);let a;const s=typeof e=="string"?{name:e}:e,o=J(),c=()=>{a&&(o.value=a.state)},u=dh(async()=>{if(r.value){if(!a)try{a=await l.permissions.query(s),De(a,"change",c),c()}catch{o.value="prompt"}return a}});return u(),n?{state:o,isSupported:r,query:u}:o}function _h(e={}){const{navigator:t=yc,read:n=!1,source:l,copiedDuring:r=1500,legacy:a=!1}=e,s=ul(()=>t&&"clipboard"in t),o=si("clipboard-read"),c=si("clipboard-write"),u=_(()=>s.value||a),d=J(""),p=J(!1),f=gh(()=>p.value=!1,r);function h(){s.value&&o.value!=="denied"?t.clipboard.readText().then(b=>{d.value=b}):d.value=k()}u.value&&n&&De(["copy","cut"],h);async function g(b=tt(l)){u.value&&b!=null&&(s.value&&c.value!=="denied"?await t.clipboard.writeText(b):E(b),d.value=b,p.value=!0,f.start())}function E(b){const L=document.createElement("textarea");L.value=b??"",L.style.position="absolute",L.style.opacity="0",document.body.appendChild(L),L.select(),document.execCommand("copy"),L.remove()}function k(){var b,L,y;return(y=(L=(b=document==null?void 0:document.getSelection)==null?void 0:b.call(document))==null?void 0:L.toString())!=null?y:""}return{isSupported:u,text:d,copied:p,copy:g}}const Cl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Bl="__vueuse_ssr_handlers__",Eh=kh();function kh(){return Bl in Cl||(Cl[Bl]=Cl[Bl]||{}),Cl[Bl]}function wh(e,t){return Eh[e]||t}function Ah(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const xh={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},ii="vueuse-storage";function Ec(e,t,n,l={}){var r;const{flush:a="pre",deep:s=!0,listenToStorageChanges:o=!0,writeDefaults:c=!0,mergeDefaults:u=!1,shallow:d,window:p=zt,eventFilter:f,onError:h=D=>{console.error(D)},initOnMounted:g}=l,E=(d?lt:J)(typeof t=="function"?t():t);if(!n)try{n=wh("getDefaultStorage",()=>{var D;return(D=zt)==null?void 0:D.localStorage})()}catch(D){h(D)}if(!n)return E;const k=tt(t),b=Ah(k),L=(r=l.serializer)!=null?r:xh[b],{pause:y,resume:T}=mh(E,()=>P(E.value),{flush:a,deep:s,eventFilter:f});return p&&o&&Da(()=>{De(p,"storage",F),De(p,ii,G),g&&F()}),g||F(),E;function P(D){try{if(D==null)n.removeItem(e);else{const V=L.write(D),ne=n.getItem(e);ne!==V&&(n.setItem(e,V),p&&p.dispatchEvent(new CustomEvent(ii,{detail:{key:e,oldValue:ne,newValue:V,storageArea:n}})))}}catch(V){h(V)}}function x(D){const V=D?D.newValue:n.getItem(e);if(V==null)return c&&k!=null&&n.setItem(e,L.write(k)),k;if(!D&&u){const ne=L.read(V);return typeof u=="function"?u(ne,k):b==="object"&&!Array.isArray(ne)?{...k,...ne}:ne}else return typeof V!="string"?V:L.read(V)}function G(D){F(D.detail)}function F(D){if(!(D&&D.storageArea!==n)){if(D&&D.key==null){E.value=k;return}if(!(D&&D.key!==e)){y();try{(D==null?void 0:D.newValue)!==L.write(E.value)&&(E.value=x(D))}catch(V){h(V)}finally{D?ln(T):T()}}}}}function Lh(e){return _c("(prefers-color-scheme: dark)",e)}function Th(e,t,n={}){const{window:l=zt,...r}=n;let a;const s=ul(()=>l&&"ResizeObserver"in l),o=()=>{a&&(a.disconnect(),a=void 0)},c=_(()=>Array.isArray(e)?e.map(p=>At(p)):[At(e)]),u=me(c,p=>{if(o(),s.value&&l){a=new ResizeObserver(t);for(const f of p)f&&a.observe(f,r)}},{immediate:!0,flush:"post",deep:!0}),d=()=>{o(),u()};return In(d),{isSupported:s,stop:d}}function Sh(e,t={width:0,height:0},n={}){const{window:l=zt,box:r="content-box"}=n,a=_(()=>{var p,f;return(f=(p=At(e))==null?void 0:p.namespaceURI)==null?void 0:f.includes("svg")}),s=J(t.width),o=J(t.height),{stop:c}=Th(e,([p])=>{const f=r==="border-box"?p.borderBoxSize:r==="content-box"?p.contentBoxSize:p.devicePixelContentBoxSize;if(l&&a.value){const h=At(e);if(h){const g=l.getComputedStyle(h);s.value=Number.parseFloat(g.width),o.value=Number.parseFloat(g.height)}}else if(f){const h=Array.isArray(f)?f:[f];s.value=h.reduce((g,{inlineSize:E})=>g+E,0),o.value=h.reduce((g,{blockSize:E})=>g+E,0)}else s.value=p.contentRect.width,o.value=p.contentRect.height},n);Da(()=>{const p=At(e);p&&(s.value="offsetWidth"in p?p.offsetWidth:t.width,o.value="offsetHeight"in p?p.offsetHeight:t.height)});const u=me(()=>At(e),p=>{s.value=p?t.width:0,o.value=p?t.height:0});function d(){c(),u()}return{width:s,height:o,stop:d}}const oi=["fullscreenchange","webkitfullscreenchange","webkitendfullscreen","mozfullscreenchange","MSFullscreenChange"];function Ma(e,t={}){const{document:n=bh,autoExit:l=!1}=t,r=_(()=>{var b;return(b=At(e))!=null?b:n==null?void 0:n.querySelector("html")}),a=J(!1),s=_(()=>["requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","webkitEnterFullScreen","webkitRequestFullScreen","mozRequestFullScreen","msRequestFullscreen"].find(b=>n&&b in n||r.value&&b in r.value)),o=_(()=>["exitFullscreen","webkitExitFullscreen","webkitExitFullScreen","webkitCancelFullScreen","mozCancelFullScreen","msExitFullscreen"].find(b=>n&&b in n||r.value&&b in r.value)),c=_(()=>["fullScreen","webkitIsFullScreen","webkitDisplayingFullscreen","mozFullScreen","msFullscreenElement"].find(b=>n&&b in n||r.value&&b in r.value)),u=["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"].find(b=>n&&b in n),d=ul(()=>r.value&&n&&s.value!==void 0&&o.value!==void 0&&c.value!==void 0),p=()=>u?(n==null?void 0:n[u])===r.value:!1,f=()=>{if(c.value){if(n&&n[c.value]!=null)return n[c.value];{const b=r.value;if((b==null?void 0:b[c.value])!=null)return!!b[c.value]}}return!1};async function h(){if(!(!d.value||!a.value)){if(o.value)if((n==null?void 0:n[o.value])!=null)await n[o.value]();else{const b=r.value;(b==null?void 0:b[o.value])!=null&&await b[o.value]()}a.value=!1}}async function g(){if(!d.value||a.value)return;f()&&await h();const b=r.value;s.value&&(b==null?void 0:b[s.value])!=null&&(await b[s.value](),a.value=!0)}async function E(){await(a.value?h():g())}const k=()=>{const b=f();(!b||b&&p())&&(a.value=b)};return De(n,oi,k,!1),De(()=>At(r),oi,k,!1),l&&In(h),{isSupported:d,isFullscreen:a,enter:g,exit:h,toggle:E}}function Sr(e){return typeof Window<"u"&&e instanceof Window?e.document.documentElement:typeof Document<"u"&&e instanceof Document?e.documentElement:e}function kc(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth1?!0:(t.preventDefault&&t.preventDefault(),!1)}const Il=new WeakMap;function wc(e,t=!1){const n=J(t);let l=null,r;me(fh(e),o=>{const c=Sr(tt(o));if(c){const u=c;Il.get(u)||Il.set(u,r),n.value&&(u.style.overflow="hidden")}},{immediate:!0});const a=()=>{const o=Sr(tt(e));!o||n.value||(ri&&(l=De(o,"touchmove",c=>{Ch(c)},{passive:!1})),o.style.overflow="hidden",n.value=!0)},s=()=>{var o;const c=Sr(tt(e));!c||!n.value||(ri&&(l==null||l()),c.style.overflow=(o=Il.get(c))!=null?o:"",Il.delete(c),n.value=!1)};return In(s),_({get(){return n.value},set(o){o?a():s()}})}function Bh(e={}){const{window:t=zt,behavior:n="auto"}=e;if(!t)return{x:J(0),y:J(0)};const l=J(t.scrollX),r=J(t.scrollY),a=_({get(){return l.value},set(o){scrollTo({left:o,behavior:n})}}),s=_({get(){return r.value},set(o){scrollTo({top:o,behavior:n})}});return De(t,"scroll",()=>{l.value=t.scrollX,r.value=t.scrollY},{capture:!1,passive:!0}),{x:a,y:s}}function Ih(e={}){const{window:t=zt,initialWidth:n=Number.POSITIVE_INFINITY,initialHeight:l=Number.POSITIVE_INFINITY,listenOrientation:r=!0,includeScrollbar:a=!0}=e,s=J(n),o=J(l),c=()=>{t&&(a?(s.value=t.innerWidth,o.value=t.innerHeight):(s.value=t.document.documentElement.clientWidth,o.value=t.document.documentElement.clientHeight))};if(c(),Da(c),De("resize",c,{passive:!0}),r){const u=_c("(orientation: portrait)");me(u,()=>c())}return{width:s,height:o}}const Ac=()=>i(ue,{name:"back-to-top"},()=>[i("path",{d:"M512 843.2c-36.2 0-66.4-13.6-85.8-21.8-10.8-4.6-22.6 3.6-21.8 15.2l7 102c.4 6.2 7.6 9.4 12.6 5.6l29-22c3.6-2.8 9-1.8 11.4 2l41 64.2c3 4.8 10.2 4.8 13.2 0l41-64.2c2.4-3.8 7.8-4.8 11.4-2l29 22c5 3.8 12.2.6 12.6-5.6l7-102c.8-11.6-11-20-21.8-15.2-19.6 8.2-49.6 21.8-85.8 21.8z"}),i("path",{d:"m795.4 586.2-96-98.2C699.4 172 513 32 513 32S324.8 172 324.8 488l-96 98.2c-3.6 3.6-5.2 9-4.4 14.2L261.2 824c1.8 11.4 14.2 17 23.6 10.8L419 744s41.4 40 94.2 40c52.8 0 92.2-40 92.2-40l134.2 90.8c9.2 6.2 21.6.6 23.6-10.8l37-223.8c.4-5.2-1.2-10.4-4.8-14zM513 384c-34 0-61.4-28.6-61.4-64s27.6-64 61.4-64c34 0 61.4 28.6 61.4 64S547 384 513 384z"})]);Ac.displayName="BackToTopIcon";const xc=()=>i(ue,{name:"close"},()=>i("path",{d:"m925.468 822.294-303.27-310.288L925.51 201.674c34.683-27.842 38.3-75.802 8.122-107.217-30.135-31.37-82.733-34.259-117.408-6.463L512.001 399.257 207.777 87.993C173.1 60.197 120.504 63.087 90.369 94.456c-30.179 31.415-26.561 79.376 8.122 107.217L401.8 512.005l-303.27 310.29c-34.724 27.82-38.34 75.846-8.117 107.194 30.135 31.437 82.729 34.327 117.408 6.486L512 624.756l304.177 311.22c34.68 27.84 87.272 24.95 117.408-6.487 30.223-31.348 26.56-79.375-8.118-107.195z"}));xc.displayName="CloseIcon";var Rh={"/":{backToTop:"返回顶部"}},Oh=M({name:"BackToTop",props:{threshold:{type:Number,default:100},noProgress:Boolean},setup(e){const t=be(),n=Bn(Rh),l=lt(),{height:r}=Sh(l),{height:a}=Ih(),{y:s}=Bh(),o=_(()=>t.value.backToTop!==!1&&s.value>e.threshold),c=_(()=>s.value/(r.value-a.value)*100);return Ee(()=>{l.value=document.body}),()=>i(jt,{name:"fade"},()=>o.value?i("button",{type:"button",class:"vp-back-to-top-button","aria-label":n.value.backToTop,"data-balloon-pos":"left",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})}},[e.noProgress?null:i("span",{class:"vp-scroll-progress",role:"progressbar","aria-labelledby":"loadinglabel","aria-valuenow":c.value},i("svg",i("circle",{cx:"50%",cy:"50%",style:{"stroke-dasharray":`calc(${Math.PI*c.value}% - ${4*Math.PI}px) calc(${Math.PI*100}% - ${4*Math.PI}px)`}}))),i(Ac)]):null)}}),Ph=M({name:"NoticeItem",props:{path:{type:String,default:""},match:{type:String,default:""},title:{type:String,required:!0},content:{type:String,required:!0},actions:{type:Array,default:()=>[]},noticeKey:{type:String,default:""},showOnce:Boolean,confirm:Boolean,fullscreen:Boolean},setup(e){const t=rt(),n=Me(),l=J(!1),r=_(()=>e.noticeKey?`notice-${e.noticeKey}`:`${e.title}${e.content}`),a=_(()=>e.match?new RegExp(e.match).test(t.path):Ht(t.path,e.path));Ee(()=>{const c=(e.showOnce?localStorage:sessionStorage).getItem(r.value);l.value=!c});const s=()=>{l.value=!1,(e.showOnce?localStorage:sessionStorage).setItem(r.value,"true")},o=c=>{c&&(Cn(c)?n.push(c):ol(c)&&window.open(c)),s()};return()=>i(Io,{name:"notice-fade"},()=>a.value&&l.value?[e.fullscreen?i("div",{key:"mask",class:"vp-notice-mask",onClick:()=>{e.confirm||s()}}):null,i("div",{key:"popup",class:["vp-notice-wrapper",{fullscreen:e.fullscreen}]},[i("header",{class:"vp-notice-title"},[e.confirm?null:i(xc,{onClick:()=>s()}),i("span",{innerHTML:e.title})]),i("div",{class:"vp-notice-content",innerHTML:e.content}),i("div",{class:"vp-notice-footer"},e.actions.map(({text:c,link:u,type:d=""})=>i("button",{type:"button",class:["vp-notice-footer-action",d],onClick:()=>o(u),innerHTML:c})))])]:[])}});const Yr=({config:e})=>{const t=rt(),n=e.find(l=>"match"in l?new RegExp(l.match).test(t.path):Ht(t.path,l.path));return n?i(Ph,n):null};Yr.displayName="Notice",Yr.props={config:{type:Array,required:!0}};const Dh=Je({enhance:({app:e})=>{ut("Badge")||e.component("Badge",mc),ut("FontIcon")||e.component("FontIcon",ah)},setup:()=>{},rootComponents:[()=>i(Oh,{}),()=>i(Yr,{config:[]})]});function Mh(e,t,n){var l,r,a;t===void 0&&(t=50),n===void 0&&(n={});var s=(l=n.isImmediate)!=null&&l,o=(r=n.callback)!=null&&r,c=n.maxWait,u=Date.now(),d=[];function p(){if(c!==void 0){var h=Date.now()-u;if(h+t>=c)return c-h}return t}var f=function(){var h=[].slice.call(arguments),g=this;return new Promise(function(E,k){var b=s&&a===void 0;if(a!==void 0&&clearTimeout(a),a=setTimeout(function(){if(a=void 0,u=Date.now(),!s){var y=e.apply(g,h);o&&o(y),d.forEach(function(T){return(0,T.resolve)(y)}),d=[]}},p()),b){var L=e.apply(g,h);return o&&o(L),E(L)}d.push({resolve:E,reject:k})})};return f.cancel=function(h){a!==void 0&&clearTimeout(a),d.forEach(function(g){return(0,g.reject)(h)}),d=[]},f}const $h=({headerLinkSelector:e,headerAnchorSelector:t,delay:n,offset:l=5})=>{const r=Me(),s=Mh(()=>{var E,k;const o=Math.max(window.scrollY,document.documentElement.scrollTop,document.body.scrollTop);if(Math.abs(o-0)f.some(L=>L.hash===b.hash));for(let b=0;b=(((E=L.parentElement)==null?void 0:E.offsetTop)??0)-l,P=!y||o<(((k=y.parentElement)==null?void 0:k.offsetTop)??0)-l;if(!(T&&P))continue;const G=decodeURIComponent(r.currentRoute.value.hash),F=decodeURIComponent(L.hash);if(G===F)return;if(p){for(let D=b+1;D{window.addEventListener("scroll",s)}),nr(()=>{window.removeEventListener("scroll",s)})},ci=async(e,t)=>{const{scrollBehavior:n}=e.options;e.options.scrollBehavior=void 0,await e.replace({query:e.currentRoute.value.query,hash:t}).finally(()=>e.options.scrollBehavior=n)},Fh=".vp-sidebar-link, .toc-link",Vh=".header-anchor",Nh=200,jh=5,Hh=Je({setup(){$h({headerLinkSelector:Fh,headerAnchorSelector:Vh,delay:Nh,offset:jh})}});let Lc=e=>se(e.title)?{title:e.title}:null;const Tc=Symbol(""),zh=e=>{Lc=e},qh=()=>he(Tc),Wh=e=>{e.provide(Tc,Lc)};var Gh={"/":{title:"目录",empty:"暂无目录"}},Uh=M({name:"AutoCatalog",props:{base:{type:String,default:""},level:{type:Number,default:3},index:Boolean,hideHeading:Boolean},setup(e){const t=qh(),n=Bn(Gh),l=ie(),r=Me(),a=jo(),s=J(r.getRoutes().map(({meta:u,path:d})=>{const p=t(u);if(!p)return null;const f=d.split("/").length;return{level:Sl(d,"/")?f-2:f-1,base:d.replace(/\/[^/]+\/?$/,"/"),path:d,...p}}).filter(u=>Oa(u)&&se(u.title))),o=()=>{const u=e.base?Sp(Ro(e.base)):l.value.path.replace(/\/[^/]+$/,"/"),d=u.split("/").length-2,p=[];return s.value.filter(({level:f,path:h})=>{if(!Ht(h,u)||h===u)return!1;if(u==="/"){const g=bt(a.value.locales).filter(E=>E!=="/");if(h==="/404.html"||g.some(E=>Ht(h,E)))return!1}return f-d<=e.level&&(Sl(h,".html")&&!Sl(h,"/index.html")||Sl(h,"/"))}).sort(({title:f,level:h,order:g},{title:E,level:k,order:b})=>h-k||(Tr(g)?Tr(b)?g>0?b>0?g-b:-1:b<0?g-b:1:g:Tr(b)?b:f.localeCompare(E))).forEach(f=>{var E;const{base:h,level:g}=f;switch(g-d){case 1:p.push(f);break;case 2:{const k=p.find(b=>b.path===h);k&&(k.children??(k.children=[])).push(f);break}default:{const k=p.find(b=>b.path===h.replace(/\/[^/]+\/$/,"/"));if(k){const b=(E=k.children)==null?void 0:E.find(L=>L.path===h);b&&(b.children??(b.children=[])).push(f)}}}}),p},c=_(()=>o());return()=>{const u=c.value.some(d=>d.children);return i("div",{class:["vp-catalog-wrapper",{index:e.index}]},[e.hideHeading?null:i("h2",{class:"vp-catalog-main-title"},n.value.title),c.value.length?i(e.index?"ol":"ul",{class:["vp-catalogs",{deep:u}]},c.value.map(({children:d=[],title:p,path:f,content:h})=>{const g=i(Ce,{class:"vp-catalog-title",to:f},()=>h?i(h):p);return i("li",{class:"vp-catalog"},u?[i("h3",{id:p,class:["vp-catalog-child-title",{"has-children":d.length}]},[i("a",{href:`#${p}`,class:"header-anchor","aria-hidden":!0},"#"),g]),d.length?i(e.index?"ol":"ul",{class:"vp-child-catalogs"},d.map(({children:E=[],content:k,path:b,title:L})=>i("li",{class:"vp-child-catalog"},[i("div",{class:["vp-catalog-sub-title",{"has-children":E.length}]},[i("a",{href:`#${L}`,class:"header-anchor"},"#"),i(Ce,{class:"vp-catalog-title",to:b},()=>k?i(k):L)]),E.length?i(e.index?"ol":"div",{class:e.index?"vp-sub-catalogs":"vp-sub-catalogs-wrapper"},E.map(({content:y,path:T,title:P})=>e.index?i("li",{class:"vp-sub-catalog"},i(Ce,{to:T},()=>y?i(y):P)):i(Ce,{class:"vp-sub-catalog-link",to:T},()=>y?i(y):P))):null]))):null]:i("div",{class:"vp-catalog-child-title"},g))})):i("p",{class:"vp-empty-catalog"},n.value.empty)])}}}),Kh=Je({enhance:({app:e})=>{Wh(e),ut("AutoCatalog",e)||e.component("AutoCatalog",Uh)}});const Jh=i("svg",{class:"external-link-icon",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",x:"0px",y:"0px",viewBox:"0 0 100 100",width:"15",height:"15"},[i("path",{fill:"currentColor",d:"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"}),i("polygon",{fill:"currentColor",points:"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"})]),Sc=M({name:"ExternalLinkIcon",props:{locales:{type:Object,required:!1,default:()=>({})}},setup(e){const t=yt(),n=_(()=>e.locales[t.value]??{openInNewWindow:"open in new window"});return()=>i("span",[Jh,i("span",{class:"external-link-icon-sr-only"},n.value.openInNewWindow)])}});var Yh={};const Zh=Yh,Qh=Je({enhance({app:e}){e.component("ExternalLinkIcon",i(Sc,{locales:Zh}))}});/** + * NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress + * @license MIT + */const de={settings:{minimum:.08,easing:"ease",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,barSelector:'[role="bar"]',parent:"body",template:'
'},status:null,set:e=>{const t=de.isStarted();e=Cr(e,de.settings.minimum,1),de.status=e===1?null:e;const n=de.render(!t),l=n.querySelector(de.settings.barSelector),r=de.settings.speed,a=de.settings.easing;return n.offsetWidth,Xh(s=>{Rl(l,{transform:"translate3d("+ui(e)+"%,0,0)",transition:"all "+r+"ms "+a}),e===1?(Rl(n,{transition:"none",opacity:"1"}),n.offsetWidth,setTimeout(function(){Rl(n,{transition:"all "+r+"ms linear",opacity:"0"}),setTimeout(function(){de.remove(),s()},r)},r)):setTimeout(()=>s(),r)}),de},isStarted:()=>typeof de.status=="number",start:()=>{de.status||de.set(0);const e=()=>{setTimeout(()=>{de.status&&(de.trickle(),e())},de.settings.trickleSpeed)};return de.settings.trickle&&e(),de},done:e=>!e&&!de.status?de:de.inc(.3+.5*Math.random()).set(1),inc:e=>{let t=de.status;return t?(typeof e!="number"&&(e=(1-t)*Cr(Math.random()*t,.1,.95)),t=Cr(t+e,0,.994),de.set(t)):de.start()},trickle:()=>de.inc(Math.random()*de.settings.trickleRate),render:e=>{if(de.isRendered())return document.getElementById("nprogress");di(document.documentElement,"nprogress-busy");const t=document.createElement("div");t.id="nprogress",t.innerHTML=de.settings.template;const n=t.querySelector(de.settings.barSelector),l=e?"-100":ui(de.status||0),r=document.querySelector(de.settings.parent);return Rl(n,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r!==document.body&&di(r,"nprogress-custom-parent"),r==null||r.appendChild(t),t},remove:()=>{pi(document.documentElement,"nprogress-busy"),pi(document.querySelector(de.settings.parent),"nprogress-custom-parent");const e=document.getElementById("nprogress");e&&e0(e)},isRendered:()=>!!document.getElementById("nprogress")},Cr=(e,t,n)=>en?n:e,ui=e=>(-1+e)*100,Xh=function(){const e=[];function t(){const n=e.shift();n&&n(t)}return function(n){e.push(n),e.length===1&&t()}}(),Rl=function(){const e=["Webkit","O","Moz","ms"],t={};function n(s){return s.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(o,c){return c.toUpperCase()})}function l(s){const o=document.body.style;if(s in o)return s;let c=e.length;const u=s.charAt(0).toUpperCase()+s.slice(1);let d;for(;c--;)if(d=e[c]+u,d in o)return d;return s}function r(s){return s=n(s),t[s]??(t[s]=l(s))}function a(s,o,c){o=r(o),s.style[o]=c}return function(s,o){for(const c in o){const u=o[c];u!==void 0&&Object.prototype.hasOwnProperty.call(o,c)&&a(s,c,u)}}}(),Cc=(e,t)=>(typeof e=="string"?e:$a(e)).indexOf(" "+t+" ")>=0,di=(e,t)=>{const n=$a(e),l=n+t;Cc(n,t)||(e.className=l.substring(1))},pi=(e,t)=>{const n=$a(e);if(!Cc(e,t))return;const l=n.replace(" "+t+" "," ");e.className=l.substring(1,l.length-1)},$a=e=>(" "+(e.className||"")+" ").replace(/\s+/gi," "),e0=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},t0=()=>{Ee(()=>{const e=Me(),t=new Set;t.add(e.currentRoute.value.path),e.beforeEach(n=>{t.has(n.path)||de.start()}),e.afterEach(n=>{t.add(n.path),de.done()})})},n0=Je({setup(){t0()}}),l0=JSON.parse('{"encrypt":{},"logo":"/logo.png","author":{"name":"Zephery","url":"https://wenzhihuai.com/article/"},"repo":"https://github.com/Zephery/MyWebsite","docsDir":"docs","pure":true,"breadcrumb":false,"footer":"粤ICP备17092242号-1","displayFooter":true,"pageInfo":["Author","Category","Tag","Original","Word","ReadingTime"],"blog":{"intro":"/about-the-author/","sidebarDisplay":"mobile","medias":{"Zhihu":"https://www.zhihu.com/people/javaZephery","Github":"https://github.com/Zephery","Gitee":"https://gitee.com/Zephery"}},"locales":{"/":{"lang":"zh-CN","navbarLocales":{"langName":"简体中文","selectLangAriaLabel":"选择语言"},"metaLocales":{"author":"作者","date":"写作日期","origin":"原创","views":"访问量","category":"分类","tag":"标签","readingTime":"阅读时间","words":"字数","toc":"此页内容","prev":"上一页","next":"下一页","lastUpdated":"上次编辑于","contributors":"贡献者","editLink":"编辑此页","print":"打印"},"blogLocales":{"article":"文章","articleList":"文章列表","category":"分类","tag":"标签","timeline":"时间轴","timelineTitle":"昨日不在","all":"全部","intro":"个人介绍","star":"星标","empty":"$text 为空"},"paginationLocales":{"prev":"上一页","next":"下一页","navigate":"跳转到","action":"前往","errorText":"请输入 1 到 $page 之前的页码!"},"outlookLocales":{"themeColor":"主题色","darkmode":"外观","fullscreen":"全屏"},"routeLocales":{"skipToContent":"跳至主要內容","notFoundTitle":"页面不存在","notFoundMsg":["这里什么也没有","我们是怎么来到这儿的?","这 是 四 零 四 !","看起来你访问了一个失效的链接"],"back":"返回上一页","home":"带我回家","openInNewWindow":"Open in new window"},"navbar":[{"text":"Java","icon":"java","link":"/index"},{"text":"数据库","icon":"database","link":"/database/"},{"text":"大数据","icon":"bigdata","link":"/bigdata/"},{"text":"Kubernetes","icon":"Kubernetes","link":"/kubernetes/"},{"text":"个人网站","icon":"personalWebsite.ts","link":"/personalWebsite/"},{"text":"其他","icon":"others","link":"/others/"},{"text":"捐赠","icon":"donate","link":"/donate/"},{"text":"网站相关","icon":"about","children":[{"text":"关于作者","icon":"zuozhe","link":"/about-the-author/"},{"text":"生活","icon":"life","link":"/life/"}]}],"sidebar":{"/database/":[{"text":"MySQL","prefix":"mysql/","icon":"mysql","collapsible":false,"children":["1mysql.md","gap锁","执行计划explain","数据库缓存"]},{"text":"Redis","prefix":"redis/","icon":"redis","collapsible":false,"children":["cache-basics","redis-questions-01","redis-questions-02"]},{"text":"Elasticsearch","prefix":"elasticsearch/","icon":"elasticsearch","collapsible":false,"children":["【elasticsearch】搜索过程详解","elasticsearch源码debug.md"]},{"text":"MongoDB","prefix":"mongodb/","icon":"mongodb","collapsible":false,"children":["mongodb-questions-01","mongodb-questions-02"]}],"/bigdata/":[{"text":"Spark","prefix":"spark/","icon":"bigdata","collapsible":false,"children":["elastic-spark.md"]}],"/personalWebsite/":[{"text":"个人网站","icon":"bigdata","collapsible":false,"children":["1.历史与架构","2.Lucene的使用","3.定时任务","4.日志系统","5.小集群部署","6.数据库备份","7.那些牛逼的插件","8.基于贝叶斯的情感分析","9.网站性能优化"]}],"/kubernetes/":[{"text":"Kubernetes","icon":"kubernetes","collapsible":false,"children":["spark on k8s operator.md"]}],"/books/":[{"text":"计算机基础","link":"cs-basics","icon":"computer"},{"text":"数据库","link":"database","icon":"database"},{"text":"搜索引擎","link":"search-engine","icon":"search"},{"text":"Java","link":"java","icon":"java"},{"text":"软件质量","link":"software-quality","icon":"highavailable"},{"text":"分布式","link":"distributed-system","icon":"distributed-network"}],"/donate/":[{"text":"微信支付","link":"README","icon":"README"}],"/others/":[{"text":"其他","collapsible":false,"children":["tesla.md","chatgpt.md"]}],"/about-the-author/":[{"text":"个人经历","icon":"experience","collapsible":false,"children":["internet-addiction-teenager","my-college-life","javaZephery-100k-star","feelings-after-one-month-of-induction-training","feelings-of-half-a-year-from-graduation-to-entry"]},{"text":"杂谈","icon":"chat","collapsible":false,"children":["writing-technology-blog-six-years","my-article-was-stolen-and-made-into-video-and-it-became-popular","dog-that-copies-other-people-essay","zhishixingqiu-two-years"]}],"/high-quality-technical-articles/":[{"text":"练级攻略","icon":"et-performance","prefix":"advanced-programmer/","collapsible":false,"children":["programmer-quickly-learn-new-technology","the-growth-strategy-of-the-technological-giant","ten-years-of-dachang-growth-road","meituan-three-year-summary-lesson-10","seven-tips-for-becoming-an-advanced-programmer","20-bad-habits-of-bad-programmers","thinking-about-technology-and-business-after-five-years-of-work"]},{"text":"个人经历","icon":"experience","prefix":"personal-experience/","collapsible":false,"children":["four-year-work-in-tencent-summary","two-years-of-back-end-develop--experience-in-didi-and-toutiao","8-years-programmer-work-summary","huawei-od-275-days"]},{"text":"程序员","icon":"code","prefix":"programmer/","collapsible":false,"children":["how-do-programmers-publish-a-technical-book","efficient-book-publishing-and-practice-Zephery"]},{"text":"面试","icon":"interview","prefix":"interview/","collapsible":true,"children":["the-experience-of-get-offer-from-over-20-big-companies","the-experience-and-thinking-of-an-interview-experienced-by-an-older-programmer","technical-preliminary-preparation","screen-candidates-for-packaging","summary-of-spring-recruitment","my-personal-experience-in-2021","how-to-examine-the-technical-ability-of-programmers-in-the-first-test-of-technology","some-secrets-about-alibaba-interview"]},{"text":"工作","icon":"work","prefix":"work/","collapsible":true,"children":["get-into-work-mode-quickly-when-you-join-a-company","32-tips-improving-career","employee-performance"]}],"/zhuanlan/":["java-mian-shi-zhi-bei","back-end-interview-high-frequency-system-design-and-scenario-questions","handwritten-rpc-framework","source-code-reading"],"/":[{"text":"Java","icon":"java","collapsible":false,"prefix":"java/","children":["JVM调优参数","lucene搜索原理","serverlog","一次jvm调优过程","内存屏障","基于kubernetes的分布式限流","锁","在 Spring 6 中使用虚拟线程.md"]}]}}}}'),r0=J(l0),Bc=()=>r0,Ic=Symbol(""),a0=()=>{const e=he(Ic);if(!e)throw new Error("useThemeLocaleData() is called without provider.");return e},s0=(e,t)=>{const{locales:n,...l}=e;return{...l,...n==null?void 0:n[t]}},i0=Je({enhance({app:e}){const t=Bc(),n=e._context.provides[Ca],l=_(()=>s0(t.value,n.value));e.provide(Ic,l),Object.defineProperties(e.config.globalProperties,{$theme:{get(){return t.value}},$themeLocale:{get(){return l.value}}})}});var o0={"/":{copy:"复制代码",copied:"已复制",hint:"复制成功"}},c0=['.theme-hope-content div[class*="language-"] pre'];const u0=800,d0=2e3,p0=o0,f0=c0,fi=!1,Br=new Map,h0=()=>{const{copy:e}=_h({legacy:!0}),t=Bn(p0),n=ie(),l=rh(),r=o=>{if(!o.hasAttribute("copy-code-registered")){const c=document.createElement("button");c.type="button",c.classList.add("copy-code-button"),c.innerHTML='
',c.setAttribute("aria-label",t.value.copy),c.setAttribute("data-copied",t.value.copied),o.parentElement&&o.parentElement.insertBefore(c,o),o.setAttribute("copy-code-registered","")}},a=()=>ln().then(()=>new Promise(o=>{setTimeout(()=>{f0.forEach(c=>{document.querySelectorAll(c).forEach(r)}),o()},u0)})),s=(o,c,u)=>{let{innerText:d=""}=c;/language-(shellscript|shell|bash|sh|zsh)/.test(o.classList.toString())&&(d=d.replace(/^ *(\$|>) /gm,"")),e(d).then(()=>{u.classList.add("copied"),clearTimeout(Br.get(u));const p=setTimeout(()=>{u.classList.remove("copied"),u.blur(),Br.delete(u)},d0);Br.set(u,p)})};Ee(()=>{(!l.value||fi)&&a(),De("click",o=>{const c=o.target;if(c.matches('div[class*="language-"] > button.copy')){const u=c.parentElement,d=c.nextElementSibling;d&&s(u,d,c)}else if(c.matches('div[class*="language-"] div.copy-icon')){const u=c.parentElement,d=u.parentElement,p=u.nextElementSibling;p&&s(d,p,u)}}),me(()=>n.value.path,()=>{(!l.value||fi)&&a()})})};var v0=Je({setup:()=>{h0()}}),m0={"/":{author:"著作权归:author所有",license:"基于:license协议",link:"原文链接::link"}};const Ir="https://wenzhihuai.com/",g0=()=>{const e=be(),t=Bn(m0),n=ie(),l=_(()=>!!e.value.copy||e.value.copy!==!1&&!0),r=_(()=>Oa(e.value.copy)?e.value.copy:null),a=_(()=>{var h;return((h=r.value)==null?void 0:h.disableCopy)??!1}),s=_(()=>{var h;return l.value?((h=r.value)==null?void 0:h.disableSelection)??!1:!1}),o=_(()=>{var h;return l.value?((h=r.value)==null?void 0:h.maxLength)??700:0}),c=_(()=>{var h;return((h=r.value)==null?void 0:h.triggerLength)??100}),u=()=>`${Kf(ol(Ir)?Ir:`https://${Ir}`)}${n.value.path}`,d=(h,g)=>{const{author:E,license:k,link:b}=t.value;return[h?E.replace(":author",h):"",g?k.replace(":license",g):"",b.replace(":link",u())].filter(L=>L).join(` +`)},p=()=>{if(gt(n.value.copyright))return n.value.copyright.replace(":link",u());const{author:h,license:g}=n.value.copyright||{};return d(h??"wenzhihuai.com",g??"MIT")},f=h=>{const g=getSelection();if(g){const E=g.getRangeAt(0);if(l.value){const k=E.toString().length;if(a.value||o.value&&k>o.value)return h.preventDefault();if(k>=c.value){h.preventDefault();const b=p(),L=document.createElement("div");L.appendChild(g.getRangeAt(0).cloneContents()),h.clipboardData&&(h.clipboardData.setData("text/html",`${L.innerHTML}
`),h.clipboardData.setData("text/plain",`${g.getRangeAt(0).cloneContents().textContent||""} +------ +${b}`))}}}};Ee(()=>{const h=document.querySelector("#app");De(h,"copy",f),ya(()=>{h.style.userSelect=s.value?"none":"auto"})})};var b0=Je({setup:()=>{g0()}});const Ol=Ec("VUEPRESS_CODE_TAB_STORE",{});var y0=M({name:"CodeTabs",props:{active:{type:Number,default:0},data:{type:Array,required:!0},id:{type:String,required:!0},tabId:{type:String,default:""}},slots:Object,setup(e,{slots:t}){const n=J(e.active),l=lt([]),r=()=>{e.tabId&&(Ol.value[e.tabId]=e.data[n.value].id)},a=(u=n.value)=>{n.value=u{n.value=u>0?u-1:l.value.length-1,l.value[n.value].focus()},o=(u,d)=>{u.key===" "||u.key==="Enter"?(u.preventDefault(),n.value=d):u.key==="ArrowRight"?(u.preventDefault(),a()):u.key==="ArrowLeft"&&(u.preventDefault(),s()),e.tabId&&(Ol.value[e.tabId]=e.data[n.value].id)},c=()=>{if(e.tabId){const u=e.data.findIndex(({id:d})=>Ol.value[e.tabId]===d);if(u!==-1)return u}return e.active};return Ee(()=>{n.value=c(),me(()=>Ol.value[e.tabId],(u,d)=>{if(e.tabId&&u!==d){const p=e.data.findIndex(({id:f})=>f===u);p!==-1&&(n.value=p)}})}),()=>e.data.length?i("div",{class:"vp-code-tabs"},[i("div",{class:"vp-code-tabs-nav",role:"tablist"},e.data.map(({id:u},d)=>{const p=d===n.value;return i("button",{type:"button",ref:f=>{f&&(l.value[d]=f)},class:["vp-code-tab-nav",{active:p}],role:"tab","aria-controls":`codetab-${e.id}-${d}`,"aria-selected":p,onClick:()=>{n.value=d,r()},onKeydown:f=>o(f,d)},t[`title${d}`]({value:u,isActive:p}))})),e.data.map(({id:u},d)=>{const p=d===n.value;return i("div",{class:["vp-code-tab",{active:p}],id:`codetab-${e.id}-${d}`,role:"tabpanel","aria-expanded":p},[i("div",{class:"vp-code-tab-title"},t[`title${d}`]({value:u,isActive:p})),t[`tab${d}`]({value:u,isActive:p})])})]):null}});const Rc=({active:e=!1},{slots:t})=>{var n;return i("div",{class:["code-group-item",{active:e}],"aria-selected":e},(n=t.default)==null?void 0:n.call(t))};Rc.displayName="CodeGroupItem";const _0=M({name:"CodeGroup",slots:Object,setup(e,{slots:t}){const n=J(-1),l=lt([]),r=(o=n.value)=>{n.value=o{n.value=o>0?o-1:l.value.length-1,l.value[n.value].focus()},s=(o,c)=>{o.key===" "||o.key==="Enter"?(o.preventDefault(),n.value=c):o.key==="ArrowRight"?(o.preventDefault(),r(c)):o.key==="ArrowLeft"&&(o.preventDefault(),a(c))};return()=>{var c;const o=(((c=t.default)==null?void 0:c.call(t))||[]).filter(u=>u.type.name==="CodeGroupItem").map(u=>(u.props===null&&(u.props={}),u));return o.length===0?null:(n.value<0||n.value>o.length-1?(n.value=o.findIndex(u=>"active"in u.props),n.value===-1&&(n.value=0)):o.forEach((u,d)=>{u.props.active=d===n.value}),i("div",{class:"code-group"},[i("div",{class:"code-group-nav"},o.map((u,d)=>{const p=d===n.value;return i("button",{type:"button",ref:f=>{f&&(l.value[d]=f)},class:["code-group-nav-tab",{active:p}],"aria-pressed":p,"aria-expanded":p,onClick:()=>{n.value=d},onKeydown:f=>s(f,d)},u.props.title)})),o]))}}}),E0=()=>{De("beforeprint",()=>{document.querySelectorAll("details").forEach(e=>{e.open=!0})})},k0=Je({enhance:({app:e})=>{e.component("CodeTabs",y0),ut("CodeGroup",e)||e.component("CodeGroup",_0),ut("CodeGroupItem",e)||e.component("CodeGroupItem",Rc)},setup:()=>{E0()}});let w0={};const Oc=Symbol(""),A0=()=>he(Oc),x0=e=>{e.provide(Oc,w0)};var L0={"/":{closeTitle:"关闭",downloadTitle:"下载图片",fullscreenTitle:"切换全屏",zoomTitle:"缩放",arrowPrevTitle:"上一个 (左箭头)",arrowNextTitle:"下一个 (右箭头)"}};const T0=".theme-hope-content :not(a) > img:not([no-view])",S0=L0,C0=800,B0='
',I0=e=>se(e)?Array.from(document.querySelectorAll(e)):e.map(t=>Array.from(document.querySelectorAll(t))).flat(),Pc=e=>new Promise((t,n)=>{e.complete?t({type:"image",element:e,src:e.src,width:e.naturalWidth,height:e.naturalHeight,alt:e.alt,msrc:e.src}):(e.onload=()=>t(Pc(e)),e.onerror=l=>n(l))}),R0=()=>{const e=Bn(S0),t=be(),n=ie(),{isSupported:l,toggle:r}=Ma(),a=A0();let s;const o=_(()=>t.value.photoSwipe===!1?!1:t.value.photoSwipe||T0),c=d=>{d.on("uiRegister",()=>{l&&d.ui.registerElement({name:"fullscreen",order:7,isButton:!0,html:'',onClick:()=>{r()}}),d.ui.registerElement({name:"download",order:8,isButton:!0,tagName:"a",html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-download"},onInit:(p,f)=>{p.setAttribute("download",""),p.setAttribute("target","_blank"),p.setAttribute("rel","noopener"),f.on("change",()=>{p.setAttribute("href",f.currSlide.data.src)})}}),d.ui.registerElement({name:"bulletsIndicator",className:"photo-swipe-bullets-indicator",appendTo:"wrapper",onInit:(p,f)=>{const h=[];let g=-1;for(let E=0;E{f.goTo(h.indexOf(b.target))},h.push(k),p.appendChild(k)}f.on("change",()=>{g>=0&&h[g].classList.remove("active"),h[f.currIndex].classList.add("active"),g=f.currIndex})}})})},u=async()=>{if(o.value)return Promise.all([A(()=>import("./photoswipe.esm-08_zHRDQ.js"),__vite__mapDeps([])),ln().then(()=>new Promise(d=>setTimeout(d,C0)).then(()=>I0(o.value)))]).then(([{default:d},p])=>{const f=p.map(h=>({html:B0,element:h,msrc:h.src}));p.forEach((h,g)=>{const E=()=>{s=new d({preloaderDelay:0,showHideAnimationType:"zoom",...e.value,...a,dataSource:f,index:g,closeOnVerticalDrag:!0,wheelToZoom:!1}),c(s),s.addFilter("thumbEl",()=>h),s.addFilter("placeholderSrc",()=>h.src),s.init()};h.style.cursor="zoom-in",h.addEventListener("click",()=>{E()}),h.addEventListener("keypress",({key:k})=>{k==="Enter"&&E()})}),p.forEach((h,g)=>{Pc(h).then(E=>{f.splice(g,1,E),s==null||s.refreshSlideContent(g)})})})};Ee(()=>{De("wheel",()=>{s==null||s.close()}),me(()=>n.value.path,u,{immediate:!0})})};var O0=Je({enhance:({app:e})=>{x0(e)},setup:()=>{R0()}});const P0=e=>e instanceof Element?document.activeElement===e&&(["TEXTAREA","SELECT","INPUT"].includes(e.tagName)||e.hasAttribute("contenteditable")):!1,D0=(e,t)=>t.some(n=>{if(se(n))return n===e.key;const{key:l,ctrl:r=!1,shift:a=!1,alt:s=!1}=n;return l===e.key&&r===e.ctrlKey&&a===e.shiftKey&&s===e.altKey}),M0=/[^\x00-\x7F]/,$0=e=>e.split(/\s+/g).map(t=>t.trim()).filter(t=>!!t),hi=e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),vi=(e,t)=>{const n=t.join(" "),l=$0(e);if(M0.test(e))return l.some(s=>n.toLowerCase().indexOf(s)>-1);const r=e.endsWith(" ");return new RegExp(l.map((s,o)=>l.length===o+1&&!r?`(?=.*\\b${hi(s)})`:`(?=.*\\b${hi(s)}\\b)`).join("")+".+","gi").test(n)},F0=({input:e,hotKeys:t})=>{if(t.value.length===0)return;const n=l=>{e.value&&D0(l,t.value)&&!P0(l.target)&&(l.preventDefault(),e.value.focus())};Ee(()=>{document.addEventListener("keydown",n)}),nr(()=>{document.removeEventListener("keydown",n)})},V0=[{title:"",headers:[],path:"/home.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/cloudnative/",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/bigdata/",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/database/",pathLocale:"/",extraFields:[]},{title:"三、DevOps",headers:[],path:"/devops/",pathLocale:"/",extraFields:[]},{title:"3.1 DevOps平台.md",headers:[{level:2,title:"一、自由风格的软件项目",slug:"一、自由风格的软件项目",link:"#一、自由风格的软件项目",children:[]},{level:2,title:"二、优化之后的CICD",slug:"二、优化之后的cicd",link:"#二、优化之后的cicd",children:[]},{level:2,title:"三、调研期",slug:"三、调研期",link:"#三、调研期",children:[]},{level:2,title:"四、产品化后的DevOps平台",slug:"四、产品化后的devops平台",link:"#四、产品化后的devops平台",children:[{level:3,title:"4.1 Java代码扫描",slug:"_4-1-java代码扫描",link:"#_4-1-java代码扫描",children:[]},{level:3,title:"4.2 Java单元测试",slug:"_4-2-java单元测试",link:"#_4-2-java单元测试",children:[]},{level:3,title:"4.3 Java构建并上传镜像",slug:"_4-3-java构建并上传镜像",link:"#_4-3-java构建并上传镜像",children:[]},{level:3,title:"4.4 部署到阿里云k8s",slug:"_4-4-部署到阿里云k8s",link:"#_4-4-部署到阿里云k8s",children:[]},{level:3,title:"4.5 整体流程",slug:"_4-5-整体流程",link:"#_4-5-整体流程",children:[]},{level:3,title:"4.4 日志",slug:"_4-4-日志",link:"#_4-4-日志",children:[]},{level:3,title:"4.5 定时触发",slug:"_4-5-定时触发",link:"#_4-5-定时触发",children:[]}]},{level:2,title:"五、其他",slug:"五、其他",link:"#五、其他",children:[{level:3,title:"5.1 Gitlab触发",slug:"_5-1-gitlab触发",link:"#_5-1-gitlab触发",children:[]}]},{level:2,title:"六、总结",slug:"六、总结",link:"#六、总结",children:[]}],path:"/devops/devops-ping-tai.html",pathLocale:"/",extraFields:[]},{title:"Git",headers:[],path:"/devops/gitlab-ci.html",pathLocale:"/",extraFields:[]},{title:"jenkins-x",headers:[],path:"/devops/jenkins-x.html",pathLocale:"/",extraFields:[]},{title:"tekton",headers:[],path:"/devops/tekton.html",pathLocale:"/",extraFields:[]},{title:"微信支付",headers:[],path:"/donate/",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/interview/jvm.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/interview/kafka.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/interview/kubernetes.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/interview/mysql.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/interview/tiktok2023.html",pathLocale:"/",extraFields:[]},{title:"JVM调优参数",headers:[{level:2,title:"一、堆大小设置",slug:"一、堆大小设置",link:"#一、堆大小设置",children:[{level:3,title:"典型设置:",slug:"典型设置",link:"#典型设置",children:[]}]},{level:2,title:"二、回收器选择",slug:"二、回收器选择",link:"#二、回收器选择",children:[{level:3,title:"2.1 吞吐量优先的并行收集器",slug:"_2-1-吞吐量优先的并行收集器",link:"#_2-1-吞吐量优先的并行收集器",children:[]},{level:3,title:"2.2 响应时间优先的并发收集器",slug:"_2-2-响应时间优先的并发收集器",link:"#_2-2-响应时间优先的并发收集器",children:[]}]},{level:2,title:"三、辅助信息",slug:"三、辅助信息",link:"#三、辅助信息",children:[{level:3,title:"3.1 堆设置",slug:"_3-1-堆设置",link:"#_3-1-堆设置",children:[]},{level:3,title:"3.2 收集器设置",slug:"_3-2-收集器设置",link:"#_3-2-收集器设置",children:[]},{level:3,title:"3.3 垃圾回收统计信息",slug:"_3-3-垃圾回收统计信息",link:"#_3-3-垃圾回收统计信息",children:[]},{level:3,title:"3.4 并行收集器设置",slug:"_3-4-并行收集器设置",link:"#_3-4-并行收集器设置",children:[]},{level:3,title:"3.5 并发收集器设置",slug:"_3-5-并发收集器设置",link:"#_3-5-并发收集器设置",children:[]}]},{level:2,title:"四、调优总结",slug:"四、调优总结",link:"#四、调优总结",children:[{level:3,title:"4.1 年轻代大小选择",slug:"_4-1-年轻代大小选择",link:"#_4-1-年轻代大小选择",children:[]},{level:3,title:"4.2 年老代大小选择",slug:"_4-2-年老代大小选择",link:"#_4-2-年老代大小选择",children:[]},{level:3,title:"4.3 较小堆引起的碎片问题",slug:"_4-3-较小堆引起的碎片问题",link:"#_4-3-较小堆引起的碎片问题",children:[]}]}],path:"/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html",pathLocale:"/",extraFields:[]},{title:"lucene搜索原理",headers:[],path:"/java/lucene%E6%90%9C%E7%B4%A2%E5%8E%9F%E7%90%86.html",pathLocale:"/",extraFields:[]},{title:"被挖矿攻击",headers:[],path:"/java/serverlog.html",pathLocale:"/",extraFields:[]},{title:"一次jvm调优过程",headers:[{level:2,title:"1. 启用jmx和远程debug模式",slug:"_1-启用jmx和远程debug模式",link:"#_1-启用jmx和远程debug模式",children:[]},{level:2,title:"2. memory analyzer、jprofiler进行堆内存分析",slug:"_2-memory-analyzer、jprofiler进行堆内存分析",link:"#_2-memory-analyzer、jprofiler进行堆内存分析",children:[]},{level:2,title:"3. netty的方面的考虑",slug:"_3-netty的方面的考虑",link:"#_3-netty的方面的考虑",children:[]},{level:2,title:"4. 直接内存排查",slug:"_4-直接内存排查",link:"#_4-直接内存排查",children:[]},{level:2,title:"5. 推荐的直接内存排查方法",slug:"_5-推荐的直接内存排查方法",link:"#_5-推荐的直接内存排查方法",children:[]},{level:2,title:"6. 意外的结果",slug:"_6-意外的结果",link:"#_6-意外的结果",children:[]},{level:2,title:"总结",slug:"总结",link:"#总结",children:[]}],path:"/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html",pathLocale:"/",extraFields:[]},{title:"内存屏障",headers:[],path:"/java/%E5%86%85%E5%AD%98%E5%B1%8F%E9%9A%9C.html",pathLocale:"/",extraFields:[]},{title:"在 Spring 6 中使用虚拟线程",headers:[{level:2,title:"一、简介",slug:"一、简介",link:"#一、简介",children:[]},{level:2,title:"二、 虚拟线程与平台线程",slug:"二、-虚拟线程与平台线程",link:"#二、-虚拟线程与平台线程",children:[]},{level:2,title:"三、在Spring 6中使用虚拟线程",slug:"三、在spring-6中使用虚拟线程",link:"#三、在spring-6中使用虚拟线程",children:[]},{level:2,title:"四、性能比较",slug:"四、性能比较",link:"#四、性能比较",children:[]}],path:"/java/%E5%9C%A8%20Spring%206%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%99%9A%E6%8B%9F%E7%BA%BF%E7%A8%8B.html",pathLocale:"/",extraFields:[]},{title:"基于kubernetes的分布式限流",headers:[{level:2,title:"一、概念",slug:"一、概念",link:"#一、概念",children:[{level:3,title:"1.1 使用场景",slug:"_1-1-使用场景",link:"#_1-1-使用场景",children:[]},{level:3,title:"1.2 维度",slug:"_1-2-维度",link:"#_1-2-维度",children:[]},{level:3,title:"1.3 分布式限流",slug:"_1-3-分布式限流",link:"#_1-3-分布式限流",children:[]}]},{level:2,title:"二、分布式限流常用方案",slug:"二、分布式限流常用方案",link:"#二、分布式限流常用方案",children:[]},{level:2,title:"三、基于kubernetes的分布式限流",slug:"三、基于kubernetes的分布式限流",link:"#三、基于kubernetes的分布式限流",children:[{level:3,title:"3.1 kubernetes中的副本数",slug:"_3-1-kubernetes中的副本数",link:"#_3-1-kubernetes中的副本数",children:[]},{level:3,title:"3.2 rateLimiter的创建",slug:"_3-2-ratelimiter的创建",link:"#_3-2-ratelimiter的创建",children:[]},{level:3,title:"3.3 rateLimiter的获取",slug:"_3-3-ratelimiter的获取",link:"#_3-3-ratelimiter的获取",children:[]},{level:3,title:"3.4 filter里的判断",slug:"_3-4-filter里的判断",link:"#_3-4-filter里的判断",children:[]}]},{level:2,title:"四、性能压测",slug:"四、性能压测",link:"#四、性能压测",children:[]},{level:2,title:"五、其他问题",slug:"五、其他问题",link:"#五、其他问题",children:[]},{level:2,title:"参考",slug:"参考",link:"#参考",children:[]}],path:"/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/kafka/",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/kubernetes/",pathLocale:"/",extraFields:[]},{title:"spark on k8s operator",headers:[],path:"/kubernetes/spark%20on%20k8s%20operator.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/life/2017.html",pathLocale:"/",extraFields:[]},{title:"",headers:[{level:2,title:"心惊胆战的裸辞经历",slug:"心惊胆战的裸辞经历",link:"#心惊胆战的裸辞经历",children:[]},{level:2,title:"工作工作",slug:"工作工作",link:"#工作工作",children:[]},{level:2,title:"跑步跑步",slug:"跑步跑步",link:"#跑步跑步",children:[]},{level:2,title:"Others",slug:"others",link:"#others",children:[]},{level:2,title:"2019",slug:"_2019",link:"#_2019",children:[]}],path:"/life/2018.html",pathLocale:"/",extraFields:[]},{title:"",headers:[{level:2,title:"工作",slug:"工作",link:"#工作",children:[]},{level:2,title:"学习",slug:"学习",link:"#学习",children:[]},{level:2,title:"感情",slug:"感情",link:"#感情",children:[]},{level:2,title:"运动",slug:"运动",link:"#运动",children:[]},{level:2,title:"其他",slug:"其他",link:"#其他",children:[]},{level:2,title:"2020展望",slug:"_2020展望",link:"#_2020展望",children:[]}],path:"/life/2019.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/life/",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/open-source-project/",pathLocale:"/",extraFields:[]},{title:"微信公众号-chatgpt智能客服搭建",headers:[{level:2,title:"一、ChatGPT注册",slug:"一、chatgpt注册",link:"#一、chatgpt注册",children:[{level:3,title:"1.1 短信手机号申请",slug:"_1-1-短信手机号申请",link:"#_1-1-短信手机号申请",children:[]},{level:3,title:"1.2 云服务器申请",slug:"_1-2-云服务器申请",link:"#_1-2-云服务器申请",children:[]},{level:3,title:"1.3 ChatGPT注册",slug:"_1-3-chatgpt注册",link:"#_1-3-chatgpt注册",children:[]}]},{level:2,title:"二、搭建nginx服务器",slug:"二、搭建nginx服务器",link:"#二、搭建nginx服务器",children:[]},{level:2,title:"三、公众号开发",slug:"三、公众号开发",link:"#三、公众号开发",children:[{level:3,title:"3.1 微信云托管",slug:"_3-1-微信云托管",link:"#_3-1-微信云托管",children:[]},{level:3,title:"3.2 一个简单ChatGPT简单回复",slug:"_3-2-一个简单chatgpt简单回复",link:"#_3-2-一个简单chatgpt简单回复",children:[]},{level:3,title:"3.3 服务部署",slug:"_3-3-服务部署",link:"#_3-3-服务部署",children:[]}]},{level:2,title:"四、没有回复(超时回复问题)",slug:"四、没有回复-超时回复问题",link:"#四、没有回复-超时回复问题",children:[]},{level:2,title:"五、会话保存",slug:"五、会话保存",link:"#五、会话保存",children:[]},{level:2,title:"六、其他问题",slug:"六、其他问题",link:"#六、其他问题",children:[{level:3,title:"6.1 限频",slug:"_6-1-限频",link:"#_6-1-限频",children:[]},{level:3,title:"6.2 秘钥key被更新",slug:"_6-2-秘钥key被更新",link:"#_6-2-秘钥key被更新",children:[]},{level:3,title:"6.3 为啥和官网的回复不一样",slug:"_6-3-为啥和官网的回复不一样",link:"#_6-3-为啥和官网的回复不一样",children:[]},{level:3,title:"6.4 玄学挂掉",slug:"_6-4-玄学挂掉",link:"#_6-4-玄学挂掉",children:[]}]},{level:2,title:"最后",slug:"最后",link:"#最后",children:[]}],path:"/others/chatgpt.html",pathLocale:"/",extraFields:[]},{title:"Tesla api",headers:[{level:2,title:"一、特斯拉应用申请",slug:"一、特斯拉应用申请",link:"#一、特斯拉应用申请",children:[{level:3,title:"1.1 创建 Tesla 账户",slug:"_1-1-创建-tesla-账户",link:"#_1-1-创建-tesla-账户",children:[]},{level:3,title:"1.2 提交访问请求",slug:"_1-2-提交访问请求",link:"#_1-2-提交访问请求",children:[]},{level:3,title:"1.3 访问应用程序凭据",slug:"_1-3-访问应用程序凭据",link:"#_1-3-访问应用程序凭据",children:[]},{level:3,title:"1.4 开始 API 集成",slug:"_1-4-开始-api-集成",link:"#_1-4-开始-api-集成",children:[]},{level:3,title:"2.1 认识token",slug:"_2-1-认识token",link:"#_2-1-认识token",children:[]},{level:3,title:"2.2 获取第三方应用token",slug:"_2-2-获取第三方应用token",link:"#_2-2-获取第三方应用token",children:[]},{level:3,title:"2.3 验证域名归属",slug:"_2-3-验证域名归属",link:"#_2-3-验证域名归属",children:[]}]}],path:"/others/tesla.html",pathLocale:"/",extraFields:[]},{title:"1.历史与架构",headers:[{level:2,title:"1.建站故事与网站架构",slug:"_1-建站故事与网站架构",link:"#_1-建站故事与网站架构",children:[{level:3,title:"1.1建站过程",slug:"_1-1建站过程",link:"#_1-1建站过程",children:[]},{level:3,title:"1.2 网站整体技术架构",slug:"_1-2-网站整体技术架构",link:"#_1-2-网站整体技术架构",children:[]},{level:3,title:"1.3 日志系统",slug:"_1-3-日志系统",link:"#_1-3-日志系统",children:[]},{level:3,title:"1.4 【有点意思】自然语言处理",slug:"_1-4-【有点意思】自然语言处理",link:"#_1-4-【有点意思】自然语言处理",children:[]}]},{level:2,title:"总结",slug:"总结",link:"#总结",children:[]}],path:"/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html",pathLocale:"/",extraFields:[]},{title:"网站重构",headers:[],path:"/personalWebsite/10.%E7%BD%91%E7%AB%99%E9%87%8D%E6%9E%84.html",pathLocale:"/",extraFields:[]},{title:"2.Lucene的使用",headers:[{level:3,title:"Lucene的整体架构",slug:"lucene的整体架构",link:"#lucene的整体架构",children:[]},{level:3,title:"搜索引擎的几个重要概念:",slug:"搜索引擎的几个重要概念",link:"#搜索引擎的几个重要概念",children:[]},{level:3,title:"Lucene中的几个概念",slug:"lucene中的几个概念",link:"#lucene中的几个概念",children:[]},{level:3,title:"lucene在本网站的使用:",slug:"lucene在本网站的使用",link:"#lucene在本网站的使用",children:[]},{level:2,title:"一、搜索",slug:"一、搜索",link:"#一、搜索",children:[]},{level:2,title:"二、lucene自动补全",slug:"二、lucene自动补全",link:"#二、lucene自动补全",children:[]}],path:"/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html",pathLocale:"/",extraFields:[]},{title:"3.定时任务",headers:[{level:3,title:"一.特点:",slug:"一-特点",link:"#一-特点",children:[]},{level:3,title:"二.主要组成部分",slug:"二-主要组成部分",link:"#二-主要组成部分",children:[]},{level:3,title:"三、Quartz设计",slug:"三、quartz设计",link:"#三、quartz设计",children:[]},{level:3,title:"四、使用",slug:"四、使用",link:"#四、使用",children:[]},{level:2,title:"Spring的高级特性之定时任务",slug:"spring的高级特性之定时任务",link:"#spring的高级特性之定时任务",children:[]}],path:"/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html",pathLocale:"/",extraFields:[]},{title:"4.日志系统.md",headers:[{level:2,title:"1.网站代码安装",slug:"_1-网站代码安装",link:"#_1-网站代码安装",children:[]},{level:2,title:"2.根据API获取数据",slug:"_2-根据api获取数据",link:"#_2-根据api获取数据",children:[]},{level:2,title:"3.构建请求",slug:"_3-构建请求",link:"#_3-构建请求",children:[]},{level:2,title:"4.实际运用",slug:"_4-实际运用",link:"#_4-实际运用",children:[]},{level:2,title:"5.基本代码",slug:"_5-基本代码",link:"#_5-基本代码",children:[]},{level:2,title:"6.展示数据",slug:"_6-展示数据",link:"#_6-展示数据",children:[]}],path:"/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html",pathLocale:"/",extraFields:[]},{title:"5.小集群部署.md",headers:[{level:2,title:"1.1 Nginx的安装",slug:"_1-1-nginx的安装",link:"#_1-1-nginx的安装",children:[]},{level:2,title:"1.2 Nginx的配置",slug:"_1-2-nginx的配置",link:"#_1-2-nginx的配置",children:[]},{level:2,title:"测试:",slug:"测试",link:"#测试",children:[]}],path:"/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html",pathLocale:"/",extraFields:[]},{title:"6.数据库备份",headers:[{level:3,title:"2.1 创建所用的复制账号",slug:"_2-1-创建所用的复制账号",link:"#_2-1-创建所用的复制账号",children:[]},{level:3,title:"2.2 配置master",slug:"_2-2-配置master",link:"#_2-2-配置master",children:[]},{level:3,title:"2.3 配置slave",slug:"_2-3-配置slave",link:"#_2-3-配置slave",children:[]}],path:"/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html",pathLocale:"/",extraFields:[]},{title:"7.那些牛逼的插件",headers:[{level:2,title:"wowslider",slug:"wowslider",link:"#wowslider",children:[]},{level:2,title:"畅言",slug:"畅言",link:"#畅言",children:[]},{level:2,title:"Editor.md",slug:"editor-md",link:"#editor-md",children:[]},{level:2,title:"图表",slug:"图表",link:"#图表",children:[]},{level:2,title:"百度分享",slug:"百度分享",link:"#百度分享",children:[]},{level:2,title:"瀑布流",slug:"瀑布流",link:"#瀑布流",children:[]},{level:2,title:"天气插件",slug:"天气插件",link:"#天气插件",children:[]},{level:2,title:"标签云",slug:"标签云",link:"#标签云",children:[]}],path:"/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html",pathLocale:"/",extraFields:[]},{title:"8.基于贝叶斯的情感分析",headers:[],path:"/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html",pathLocale:"/",extraFields:[]},{title:"9.网站性能优化",headers:[],path:"/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/personalWebsite/",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/redis/",pathLocale:"/",extraFields:[]},{title:"一、概述",headers:[{level:2,title:"1.1 缓存介绍",slug:"_1-1-缓存介绍",link:"#_1-1-缓存介绍",children:[]},{level:2,title:"1.2 本站缓存架构",slug:"_1-2-本站缓存架构",link:"#_1-2-本站缓存架构",children:[]},{level:2,title:"2.1 mybatis一级缓存",slug:"_2-1-mybatis一级缓存",link:"#_2-1-mybatis一级缓存",children:[]},{level:2,title:"2.2 mybatis二级缓存",slug:"_2-2-mybatis二级缓存",link:"#_2-2-mybatis二级缓存",children:[{level:3,title:"2.2.1 MyBatis二级缓存的划分",slug:"_2-2-1-mybatis二级缓存的划分",link:"#_2-2-1-mybatis二级缓存的划分",children:[]},{level:3,title:"2.2.2 二级缓存的开启",slug:"_2-2-2-二级缓存的开启",link:"#_2-2-2-二级缓存的开启",children:[]},{level:3,title:"2.2.3 使用第三方支持的二级缓存的实现",slug:"_2-2-3-使用第三方支持的二级缓存的实现",link:"#_2-2-3-使用第三方支持的二级缓存的实现",children:[]}]},{level:2,title:"2.3 Mybatis在分布式环境下脏读问题",slug:"_2-3-mybatis在分布式环境下脏读问题",link:"#_2-3-mybatis在分布式环境下脏读问题",children:[]},{level:2,title:"3.1 Spring Cache",slug:"_3-1-spring-cache",link:"#_3-1-spring-cache",children:[]},{level:2,title:"3.2 引入包",slug:"_3-2-引入包",link:"#_3-2-引入包",children:[]},{level:2,title:"3.3 ApplicationContext.xml",slug:"_3-3-applicationcontext-xml",link:"#_3-3-applicationcontext-xml",children:[]},{level:2,title:"3.5 自定义KeyGenerator",slug:"_3-5-自定义keygenerator",link:"#_3-5-自定义keygenerator",children:[]},{level:2,title:"3.4 添加注解",slug:"_3-4-添加注解",link:"#_3-4-添加注解",children:[]},{level:2,title:"3.5 测试",slug:"_3-5-测试",link:"#_3-5-测试",children:[]},{level:2,title:"3.6 实验结果",slug:"_3-6-实验结果",link:"#_3-6-实验结果",children:[]},{level:2,title:"3.7 分页的数据怎么办",slug:"_3-7-分页的数据怎么办",link:"#_3-7-分页的数据怎么办",children:[]}],path:"/redis/redis%E7%BC%93%E5%AD%98.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/bigdata/spark/",pathLocale:"/",extraFields:[]},{title:"elastic spark",headers:[{level:2,title:"一、原生RDD支持",slug:"一、原生rdd支持",link:"#一、原生rdd支持",children:[{level:3,title:"1.1 基础配置",slug:"_1-1-基础配置",link:"#_1-1-基础配置",children:[]},{level:3,title:"1.2 读取es数据",slug:"_1-2-读取es数据",link:"#_1-2-读取es数据",children:[]},{level:3,title:"1.3 写数据",slug:"_1-3-写数据",link:"#_1-3-写数据",children:[]}]},{level:2,title:"二、Spark Streaming",slug:"二、spark-streaming",link:"#二、spark-streaming",children:[]},{level:2,title:"三、Spark SQL",slug:"三、spark-sql",link:"#三、spark-sql",children:[]},{level:2,title:"四、Spark Structure Streaming",slug:"四、spark-structure-streaming",link:"#四、spark-structure-streaming",children:[]},{level:2,title:"五、Spark on kubernetes Operator",slug:"五、spark-on-kubernetes-operator",link:"#五、spark-on-kubernetes-operator",children:[]}],path:"/bigdata/spark/elastic-spark.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/database/elasticsearch/",pathLocale:"/",extraFields:[]},{title:"【elasticsearch】源码debug",headers:[],path:"/database/elasticsearch/elasticsearch%E6%BA%90%E7%A0%81debug.html",pathLocale:"/",extraFields:[]},{title:"【elasticsearch】搜索过程详解",headers:[{level:3,title:"SearchType",slug:"searchtype",link:"#searchtype",children:[]},{level:2,title:"搜索入口:",slug:"搜索入口",link:"#搜索入口",children:[]},{level:2,title:"3.1 query阶段",slug:"_3-1-query阶段",link:"#_3-1-query阶段",children:[]},{level:2,title:"3.2 Fetch阶段",slug:"_3-2-fetch阶段",link:"#_3-2-fetch阶段",children:[{level:3,title:"3.2.1 FetchSearchPhase(对应上面的1)",slug:"_3-2-1-fetchsearchphase-对应上面的1",link:"#_3-2-1-fetchsearchphase-对应上面的1",children:[]},{level:3,title:"3.2.2 ExpandSearchPhase(对应上图的2)",slug:"_3-2-2-expandsearchphase-对应上图的2",link:"#_3-2-2-expandsearchphase-对应上图的2",children:[]}]},{level:2,title:"4.1 执行query、fetch流程",slug:"_4-1-执行query、fetch流程",link:"#_4-1-执行query、fetch流程",children:[]}],path:"/database/elasticsearch/%E3%80%90elasticsearch%E3%80%91%E6%90%9C%E7%B4%A2%E8%BF%87%E7%A8%8B%E8%AF%A6%E8%A7%A3.html",pathLocale:"/",extraFields:[]},{title:"mysql",headers:[],path:"/database/mysql/1mysql.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/database/mysql/",pathLocale:"/",extraFields:[]},{title:"gap锁",headers:[],path:"/database/mysql/gap%E9%94%81.html",pathLocale:"/",extraFields:[]},{title:"执行计划explain",headers:[],path:"/database/mysql/%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92explain.html",pathLocale:"/",extraFields:[]},{title:"数据库缓存",headers:[],path:"/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html",pathLocale:"/",extraFields:[]},{title:"",headers:[],path:"/404.html",pathLocale:"/",extraFields:[]},{title:"Interview",headers:[],path:"/interview/",pathLocale:"/",extraFields:[]},{title:"Java",headers:[],path:"/java/",pathLocale:"/",extraFields:[]},{title:"Others",headers:[],path:"/others/",pathLocale:"/",extraFields:[]},{title:"分类",headers:[],path:"/category/",pathLocale:"/",extraFields:[]},{title:"标签",headers:[],path:"/tag/",pathLocale:"/",extraFields:[]},{title:"文章",headers:[],path:"/article/",pathLocale:"/",extraFields:[]},{title:"星标",headers:[],path:"/star/",pathLocale:"/",extraFields:[]},{title:"时间轴",headers:[],path:"/timeline/",pathLocale:"/",extraFields:[]}],N0=J(V0),j0=()=>N0,H0=({searchIndex:e,routeLocale:t,query:n,maxSuggestions:l})=>{const r=_(()=>e.value.filter(a=>a.pathLocale===t.value));return _(()=>{const a=n.value.trim().toLowerCase();if(!a)return[];const s=[],o=(c,u)=>{vi(a,[u.title])&&s.push({link:`${c.path}#${u.slug}`,title:c.title,header:u.title});for(const d of u.children){if(s.length>=l.value)return;o(c,d)}};for(const c of r.value){if(s.length>=l.value)break;if(vi(a,[c.title,...c.extraFields])){s.push({link:c.path,title:c.title});continue}for(const u of c.headers){if(s.length>=l.value)break;o(c,u)}}return s})},z0=e=>{const t=J(0);return{focusIndex:t,focusNext:()=>{t.value{t.value>0?t.value-=1:t.value=e.value.length-1}}},q0=M({name:"SearchBox",props:{locales:{type:Object,required:!1,default:()=>({})},hotKeys:{type:Array,required:!1,default:()=>[]},maxSuggestions:{type:Number,required:!1,default:5}},setup(e){const{locales:t,hotKeys:n,maxSuggestions:l}=Id(e),r=Me(),a=yt(),s=j0(),o=J(null),c=J(!1),u=J(""),d=_(()=>t.value[a.value]??{}),p=H0({searchIndex:s,routeLocale:a,query:u,maxSuggestions:l}),{focusIndex:f,focusNext:h,focusPrev:g}=z0(p);F0({input:o,hotKeys:n});const E=_(()=>c.value&&!!p.value.length),k=()=>{E.value&&g()},b=()=>{E.value&&h()},L=y=>{if(!E.value)return;const T=p.value[y];T&&r.push(T.link).then(()=>{u.value="",f.value=0})};return()=>i("form",{class:"search-box",role:"search"},[i("input",{ref:o,type:"search",placeholder:d.value.placeholder,autocomplete:"off",spellcheck:!1,value:u.value,onFocus:()=>c.value=!0,onBlur:()=>c.value=!1,onInput:y=>u.value=y.target.value,onKeydown:y=>{switch(y.key){case"ArrowUp":{k();break}case"ArrowDown":{b();break}case"Enter":{y.preventDefault(),L(f.value);break}}}}),E.value&&i("ul",{class:"suggestions",onMouseleave:()=>f.value=-1},p.value.map(({link:y,title:T,header:P},x)=>i("li",{class:["suggestion",{focus:f.value===x}],onMouseenter:()=>f.value=x,onMousedown:()=>L(x)},i("a",{href:y,onClick:G=>G.preventDefault()},[i("span",{class:"page-title"},T),P&&i("span",{class:"page-header"},`> ${P}`)]))))])}});var W0=["s","/"],G0={"/":{placeholder:"搜索"}};const U0=G0,K0=W0,J0=10,Y0=Je({enhance({app:e}){e.component("SearchBox",t=>i(q0,{locales:U0,hotKeys:K0,maxSuggestions:J0,...t}))}});var mi={"/":{word:"约 $word 字",less1Minute:"小于 1 分钟",time:"大约 $time 分钟"}};const Dc=()=>{const e=ie();return _(()=>e.value.readingTime??null)},Zr=typeof mi>"u"?null:mi,Mc=(e,t)=>{const{minutes:n,words:l}=e,{less1Minute:r,word:a,time:s}=t;return{time:n<1?r:s.replace("$time",Math.round(n).toString()),words:a.replace("$word",l.toString())}},gi={words:"",time:""},$c=()=>Zr?Bn(Zr):_(()=>null),Z0=()=>{if(typeof Zr>"u")return _(()=>gi);const e=Dc(),t=$c();return _(()=>e.value&&t.value?Mc(e.value,t.value):gi)},qt=()=>Bc(),oe=()=>a0(),an=()=>_(()=>!!qt().value.pure);var Rr=M({name:"EmptyComponent",setup:()=>()=>null});const Q0="719px",X0="1440px",e2="false",Fa={mobileBreakPoint:Q0,pcBreakPoint:X0,enableThemeColor:e2},Va={},Fc=e=>{const{icon:t="",color:n,size:l}=e,r={};return n&&(r.color=n),l&&(r.height=Number.isNaN(Number(l))?l:`${l}px`),rn(t)?i("img",{class:"icon",src:t,"no-view":"",style:r}):Cn(t)?i("img",{class:"icon",src:xe(t),"aria-hidden":"","no-view":"",style:r}):i(Ke("FontIcon"),e)};Fc.displayName="HopeIcon";var Ne=Fc;const dl=()=>{const e=Me(),t=rt();return n=>{if(n)if(Cn(n))t.path!==n&&e.push(n);else if(Oo(n))window&&window.open(n);else{const l=t.path.slice(0,t.path.lastIndexOf("/"));e.push(`${l}/${encodeURI(n)}`)}}},Vc=()=>{const e=oe(),t=be();return _(()=>{const{author:n}=t.value;return n?Xn(n):n===!1?[]:Xn(e.value.author,!1)})},t2=()=>{const e=be();return _(()=>sc(e.value.category).map(t=>{var n,l;return{name:t,path:((l=(n=he(Symbol.for("categoryMap")))==null?void 0:n.value.map[t])==null?void 0:l.path)||""}}))},n2=()=>{const e=be();return _(()=>ic(e.value.tag).map(t=>{var n,l;return{name:t,path:((l=(n=he(Symbol.for("tagMap")))==null?void 0:n.value.map[t])==null?void 0:l.path)||""}}))},l2=()=>{const e=be(),t=ie();return _(()=>{const n=Ra(e.value.date);if(n)return n;const{createdTime:l}=t.value.git||{};return l?new Date(l):null})},r2=()=>{const e=oe(),t=ie(),n=be(),l=Vc(),r=t2(),a=n2(),s=l2(),o=Dc(),c=Z0(),u=_(()=>({author:l.value,category:r.value,date:s.value,localizedDate:t.value.localizedDate,tag:a.value,isOriginal:n.value.isOriginal||!1,readingTime:o.value,readingTimeLocale:c.value,pageview:"pageview"in n.value?n.value.pageview:!0})),d=_(()=>"pageInfo"in n.value?n.value.pageInfo:"pageInfo"in e.value?e.value.pageInfo:null);return{info:u,items:d}},{mobileBreakPoint:a2,pcBreakPoint:s2}=Fa,bi=e=>e.endsWith("px")?Number(e.slice(0,-2)):null,pl=()=>{const e=J(!1),t=J(!1),n=()=>{e.value=window.innerWidth<=(bi(a2)??719),t.value=window.innerWidth>=(bi(s2)??1440)};return Ee(()=>{n(),De("resize",n,!1),De("orientationchange",n,!1)}),{isMobile:e,isPC:t}},Nc=Symbol(""),fl=()=>{const e=he(Nc);if(!e)throw new Error("useDarkmode() is called without provider.");return e},i2=e=>{const t=qt(),n=Lh(),l=Ec("vuepress-theme-hope-scheme","auto"),r=_(()=>t.value.darkmode||"switch"),a=_(()=>{const o=r.value;return o==="disable"?!1:o==="enable"?!0:o==="auto"?n.value:o==="toggle"?l.value==="dark":l.value==="dark"||l.value==="auto"&&n.value}),s=_(()=>{const o=r.value;return o==="switch"||o==="toggle"});e.provide(Nc,{canToggle:s,config:r,isDarkmode:a,status:l}),Object.defineProperties(e.config.globalProperties,{$isDarkmode:{get:()=>a.value}})},o2=()=>{const{isDarkmode:e}=fl(),t=(n=e.value)=>document.documentElement.setAttribute("data-theme",n?"dark":"light");Ee(()=>{me(e,t,{immediate:!0})})};var ze=M({name:"AutoLink",inheritAttrs:!1,props:{config:{type:Object,required:!0},exact:Boolean,noExternalLinkIcon:Boolean},emits:["focusout"],slots:Object,setup(e,{attrs:t,emit:n,slots:l}){const r=rt(),a=jo(),s=Ln(e,"config"),o=_(()=>rn(s.value.link)),c=_(()=>!o.value&&Oo(s.value.link)),u=_(()=>s.value.target||(o.value?"_blank":void 0)),d=_(()=>u.value==="_blank"),p=_(()=>!o.value&&!c.value&&!d.value),f=_(()=>s.value.rel||(d.value?"noopener noreferrer":void 0)),h=_(()=>s.value.ariaLabel||s.value.text),g=_(()=>{if(e.exact)return!1;const k=bt(a.value.locales);return k.length?k.every(b=>b!==s.value.link):s.value.link!=="/"}),E=_(()=>p.value?s.value.activeMatch?new RegExp(s.value.activeMatch).test(r.path):g.value?Ht(r.path,s.value.link):r.path===s.value.link:!1);return()=>{const{before:k,after:b,default:L}=l,{text:y,icon:T,link:P}=s.value;return p.value?i(Ce,{to:P,"aria-label":h.value,...t,class:["nav-link",{active:E.value},t.class],onFocusout:()=>n("focusout")},()=>L?L():[k?k():i(Ne,{icon:T}),y,b==null?void 0:b()]):i("a",{href:P,rel:f.value,target:u.value,"aria-label":h.value,...t,class:["nav-link",t.class],onFocusout:()=>n("focusout")},L?L():[k?k():i(Ne,{icon:T}),y,e.noExternalLinkIcon?null:i(Sc),b==null?void 0:b()])}}});const An=(e,t,n=!1)=>"activeMatch"in t?new RegExp(t.activeMatch).test(e.path):cc(e,t.link)?!0:t.children&&!n?t.children.some(l=>An(e,l)):!1,jc=(e,t)=>t.type==="group"?t.children.some(n=>n.type==="group"?jc(e,n):n.type==="page"&&An(e,n,!0))||"prefix"in t&&cc(e,t.prefix):!1,Hc=(e,t)=>se(e.link)?i(ze,{...t,config:e}):i("p",t,[i(Ne,{icon:e.icon}),e.text]),zc=e=>{const t=rt();return e?i("ul",{class:"vp-sidebar-sub-headers"},e.map(n=>i("li",{class:"vp-sidebar-sub-header"},[Hc(n,{class:["vp-sidebar-link","vp-heading",{active:An(t,n,!0)}]}),zc(n.children)]))):null};var _e=(e=>(e.type="y",e.title="t",e.shortTitle="s",e.icon="i",e.author="a",e.date="d",e.localizedDate="l",e.category="c",e.tag="g",e.isEncrypted="n",e.isOriginal="o",e.readingTime="r",e.excerpt="e",e.sticky="u",e.cover="v",e.index="I",e.order="O",e))(_e||{}),qc=(e=>(e.article="a",e.home="h",e.slide="s",e.page="p",e))(qc||{});const Yt=(e="",t="")=>Cn(t)?t:`${Ro(e)}${t}`,mn=(e,t,n=!1)=>{let l=wn(e,rc(encodeURI(t)));l.name==="404"&&(l=wn(e,t));const{fullPath:r,meta:a,name:s}=l;return{text:!n&&a[_e.shortTitle]?a[_e.shortTitle]:a[_e.title]||t,link:s==="404"?t:r,...a[_e.icon]?{icon:a[_e.icon]}:{}}},c2=(e,t)=>{const n=ie();return{type:"heading",text:e.title,link:`${n.value.path}#${e.slug}`,children:Na(e.children,t)}},Na=(e,t)=>t>0?e.map(n=>c2(n,t-1)):[],Wc=e=>{const t=ie();return Na(t.value.headers,e)},Qr=(e,t,n="")=>{const l=Me(),r=ie(),a=(s,o=n)=>{var u;const c=se(s)?mn(l,Yt(o,s)):s.link?{...s,...Gl(s.link)?{}:{link:mn(l,Yt(o,s.link)).link}}:s;if("children"in c){const d=Yt(o,c.prefix),p=c.children==="structure"?Va[d]:c.children;return{type:"group",...c,prefix:d,children:p.map(f=>a(f,d))}}return{type:"page",...c,children:c.link===r.value.path?Na(((u=r.value.headers[0])==null?void 0:u.level)===1?r.value.headers[0].children:r.value.headers,t):[]}};return e.map(s=>a(s))},u2=(e,t)=>{const n=ie(),l=bt(e).sort((r,a)=>a.length-r.length);for(const r of l)if(Ht(decodeURI(n.value.path),r)){const a=e[r];return a?Qr(a==="structure"?Va[r]:a==="heading"?Wc(t):a,t,r):[]}return console.warn(`${n.value.path} is missing sidebar config.`),[]},d2=(e,t)=>{const n=yt();return e===!1?[]:e==="heading"?Wc(t):e==="structure"?Qr(Va[n.value],t,n.value):X(e)?Qr(e,t):La(e)?u2(e,t):[]},Gc=Symbol(""),p2=()=>{const e=be(),t=oe(),n=ie(),l=_(()=>e.value.home?!1:e.value.sidebar??t.value.sidebar??"structure"),r=_(()=>e.value.headerDepth??t.value.headerDepth??2),a=Pa(()=>[l.value,r.value,n.value.path,null],()=>d2(l.value,r.value));ct(Gc,a)},ja=()=>{const e=he(Gc);if(!e)throw new Error("useSidebarItems() is called without provider.");return e};var f2=M({name:"PageFooter",setup(){const e=qt(),t=oe(),n=be(),l=Vc(),r=_(()=>{const{copyright:u,footer:d}=n.value;return d!==!1&&!!(u||d||t.value.displayFooter)}),a=_(()=>{const{footer:u}=n.value;return u===!1?!1:se(u)?u:t.value.footer||""}),s=_(()=>l.value.map(({name:u})=>u).join(", ")),o=u=>`Copyright © ${new Date().getFullYear()} ${s.value} ${u?`${u} Licensed`:""}`,c=_(()=>{const{copyright:u,license:d=""}=n.value,{license:p}=e.value,{copyright:f}=t.value;return u??(d?o(d):se(f)?f:s.value||p?o(p):!1)});return()=>r.value?i("footer",{class:"vp-footer-wrapper"},[a.value?i("div",{class:"vp-footer",innerHTML:a.value}):null,c.value?i("div",{class:"vp-copyright",innerHTML:c.value}):null]):null}}),h2=M({name:"NavbarDropdownLink",props:{config:{type:Object,required:!0}},slots:Object,setup(e,{slots:t}){const n=ie(),l=Ln(e,"config"),r=_(()=>l.value.ariaLabel||l.value.text),a=J(!1);me(()=>n.value.path,()=>{a.value=!1});const s=o=>{o.detail===0&&(a.value=!a.value)};return()=>{var o;return i("div",{class:["dropdown-wrapper",{open:a.value}]},[i("button",{type:"button",class:"dropdown-title","aria-label":r.value,onClick:s},[((o=t.title)==null?void 0:o.call(t))||i("span",{class:"title"},[i(Ne,{icon:l.value.icon}),e.config.text]),i("span",{class:"arrow"}),i("ul",{class:"nav-dropdown"},l.value.children.map((c,u)=>{const d=u===l.value.children.length-1;return i("li",{class:"dropdown-item"},"children"in c?[i("h4",{class:"dropdown-subtitle"},c.link?i(ze,{config:c,onFocusout:()=>{c.children.length===0&&d&&(a.value=!1)}}):i("span",c.text)),i("ul",{class:"dropdown-subitem-wrapper"},c.children.map((p,f)=>i("li",{class:"dropdown-subitem"},i(ze,{config:p,onFocusout:()=>{f===c.children.length-1&&d&&(a.value=!1)}}))))]:i(ze,{config:c,onFocusout:()=>{d&&(a.value=!1)}}))}))])])}}});const Uc=(e,t,n="")=>se(t)?mn(e,Yt(n,t)):"children"in t?{...t,...t.link&&!Gl(t.link)?mn(e,Yt(n,t.link)):{},children:t.children.map(l=>Uc(e,l,Yt(n,t.prefix)))}:{...t,link:Gl(t.link)?t.link:mn(e,Yt(n,t.link)).link},Kc=()=>{const e=oe(),t=Me(),n=()=>(e.value.navbar||[]).map(l=>Uc(t,l));return Pa(()=>e.value.navbar,()=>n())},v2=()=>{const e=oe(),t=_(()=>e.value.repo||null),n=_(()=>t.value?th(t.value):null),l=_(()=>t.value?uc(t.value):null),r=_(()=>n.value?e.value.repoLabel??(l.value===null?"Source":l.value):null);return _(()=>!n.value||!r.value||e.value.repoDisplay===!1?null:{type:l.value||"Source",label:r.value,link:n.value})};var m2=M({name:"NavScreenDropdown",props:{config:{type:Object,required:!0}},setup(e){const t=ie(),n=Ln(e,"config"),l=_(()=>n.value.ariaLabel||n.value.text),r=J(!1);me(()=>t.value.path,()=>{r.value=!1});const a=(s,o)=>o[o.length-1]===s;return()=>[i("button",{type:"button",class:["nav-screen-dropdown-title",{active:r.value}],"aria-label":l.value,onClick:()=>{r.value=!r.value}},[i("span",{class:"title"},[i(Ne,{icon:n.value.icon}),e.config.text]),i("span",{class:["arrow",r.value?"down":"end"]})]),i("ul",{class:["nav-screen-dropdown",{hide:!r.value}]},n.value.children.map(s=>i("li",{class:"dropdown-item"},"children"in s?[i("h4",{class:"dropdown-subtitle"},s.link?i(ze,{config:s,onFocusout:()=>{a(s,n.value.children)&&s.children.length===0&&(r.value=!1)}}):i("span",s.text)),i("ul",{class:"dropdown-subitem-wrapper"},s.children.map(o=>i("li",{class:"dropdown-subitem"},i(ze,{config:o,onFocusout:()=>{a(o,s.children)&&a(s,n.value.children)&&(r.value=!1)}}))))]:i(ze,{config:s,onFocusout:()=>{a(s,n.value.children)&&(r.value=!1)}}))))]}}),g2=M({name:"NavScreenLinks",setup(){const e=Kc();return()=>e.value.length?i("nav",{class:"nav-screen-links"},e.value.map(t=>i("div",{class:"navbar-links-item"},"children"in t?i(m2,{config:t}):i(ze,{config:t})))):null}});const Jc=()=>i(ue,{name:"dark"},()=>i("path",{d:"M524.8 938.667h-4.267a439.893 439.893 0 0 1-313.173-134.4 446.293 446.293 0 0 1-11.093-597.334A432.213 432.213 0 0 1 366.933 90.027a42.667 42.667 0 0 1 45.227 9.386 42.667 42.667 0 0 1 10.24 42.667 358.4 358.4 0 0 0 82.773 375.893 361.387 361.387 0 0 0 376.747 82.774 42.667 42.667 0 0 1 54.187 55.04 433.493 433.493 0 0 1-99.84 154.88 438.613 438.613 0 0 1-311.467 128z"}));Jc.displayName="DarkIcon";const Yc=()=>i(ue,{name:"light"},()=>i("path",{d:"M952 552h-80a40 40 0 0 1 0-80h80a40 40 0 0 1 0 80zM801.88 280.08a41 41 0 0 1-57.96-57.96l57.96-58a41.04 41.04 0 0 1 58 58l-58 57.96zM512 752a240 240 0 1 1 0-480 240 240 0 0 1 0 480zm0-560a40 40 0 0 1-40-40V72a40 40 0 0 1 80 0v80a40 40 0 0 1-40 40zm-289.88 88.08-58-57.96a41.04 41.04 0 0 1 58-58l57.96 58a41 41 0 0 1-57.96 57.96zM192 512a40 40 0 0 1-40 40H72a40 40 0 0 1 0-80h80a40 40 0 0 1 40 40zm30.12 231.92a41 41 0 0 1 57.96 57.96l-57.96 58a41.04 41.04 0 0 1-58-58l58-57.96zM512 832a40 40 0 0 1 40 40v80a40 40 0 0 1-80 0v-80a40 40 0 0 1 40-40zm289.88-88.08 58 57.96a41.04 41.04 0 0 1-58 58l-57.96-58a41 41 0 0 1 57.96-57.96z"}));Yc.displayName="LightIcon";const Zc=()=>i(ue,{name:"auto"},()=>i("path",{d:"M512 992C246.92 992 32 777.08 32 512S246.92 32 512 32s480 214.92 480 480-214.92 480-480 480zm0-840c-198.78 0-360 161.22-360 360 0 198.84 161.22 360 360 360s360-161.16 360-360c0-198.78-161.22-360-360-360zm0 660V212c165.72 0 300 134.34 300 300 0 165.72-134.28 300-300 300z"}));Zc.displayName="AutoIcon";const Qc=()=>i(ue,{name:"enter-fullscreen"},()=>i("path",{d:"M762.773 90.24h-497.28c-96.106 0-174.4 78.293-174.4 174.4v497.28c0 96.107 78.294 174.4 174.4 174.4h497.28c96.107 0 175.04-78.293 174.4-174.4V264.64c0-96.213-78.186-174.4-174.4-174.4zm-387.2 761.173H215.04c-21.867 0-40.427-17.92-41.067-41.066V649.92c0-22.507 17.92-40.427 40.427-40.427 11.307 0 21.227 4.694 28.48 11.947 7.253 7.253 11.947 17.92 11.947 28.48v62.293l145.28-145.28c15.893-15.893 41.813-15.893 57.706 0 15.894 15.894 15.894 41.814 0 57.707l-145.28 145.28h62.294c22.506 0 40.426 17.92 40.426 40.427s-17.173 41.066-39.68 41.066zM650.24 165.76h160.427c21.866 0 40.426 17.92 41.066 41.067v160.426c0 22.507-17.92 40.427-40.426 40.427-11.307 0-21.227-4.693-28.48-11.947-7.254-7.253-11.947-17.92-11.947-28.48v-62.186L625.6 450.347c-15.893 15.893-41.813 15.893-57.707 0-15.893-15.894-15.893-41.814 0-57.707l145.28-145.28H650.88c-22.507 0-40.427-17.92-40.427-40.427s17.174-41.173 39.787-41.173z"}));Qc.displayName="EnterFullScreenIcon";const Xc=()=>i(ue,{name:"cancel-fullscreen"},()=>i("path",{d:"M778.468 78.62H247.922c-102.514 0-186.027 83.513-186.027 186.027V795.08c0 102.514 83.513 186.027 186.027 186.027h530.432c102.514 0 186.71-83.513 186.026-186.027V264.647C964.494 162.02 880.981 78.62 778.468 78.62zM250.88 574.35h171.122c23.324 0 43.122 19.115 43.804 43.805v171.121c0 24.008-19.114 43.122-43.122 43.122-12.06 0-22.641-5.006-30.378-12.743s-12.743-19.115-12.743-30.379V722.83L224.597 877.91c-16.953 16.952-44.6 16.952-61.553 0-16.953-16.954-16.953-44.602 0-61.554L318.009 661.39h-66.446c-24.007 0-43.122-19.114-43.122-43.122 0-24.12 18.432-43.918 42.439-43.918zm521.899-98.873H601.657c-23.325 0-43.122-19.114-43.805-43.804V260.55c0-24.007 19.115-43.122 43.122-43.122 12.06 0 22.642 5.007 30.379 12.743s12.743 19.115 12.743 30.38v66.445l154.965-154.965c16.953-16.953 44.601-16.953 61.554 0 16.953 16.953 16.953 44.6 0 61.554L705.536 388.55h66.446c24.007 0 43.122 19.115 43.122 43.122.114 24.007-18.318 43.804-42.325 43.804z"}));Xc.displayName="CancelFullScreenIcon";const eu=()=>i(ue,{name:"outlook"},()=>[i("path",{d:"M224 800c0 9.6 3.2 44.8 6.4 54.4 6.4 48-48 76.8-48 76.8s80 41.6 147.2 0 134.4-134.4 38.4-195.2c-22.4-12.8-41.6-19.2-57.6-19.2C259.2 716.8 227.2 761.6 224 800zM560 675.2l-32 51.2c-51.2 51.2-83.2 32-83.2 32 25.6 67.2 0 112-12.8 128 25.6 6.4 51.2 9.6 80 9.6 54.4 0 102.4-9.6 150.4-32l0 0c3.2 0 3.2-3.2 3.2-3.2 22.4-16 12.8-35.2 6.4-44.8-9.6-12.8-12.8-25.6-12.8-41.6 0-54.4 60.8-99.2 137.6-99.2 6.4 0 12.8 0 22.4 0 12.8 0 38.4 9.6 48-25.6 0-3.2 0-3.2 3.2-6.4 0-3.2 3.2-6.4 3.2-6.4 6.4-16 6.4-16 6.4-19.2 9.6-35.2 16-73.6 16-115.2 0-105.6-41.6-198.4-108.8-268.8C704 396.8 560 675.2 560 675.2zM224 419.2c0-28.8 22.4-51.2 51.2-51.2 28.8 0 51.2 22.4 51.2 51.2 0 28.8-22.4 51.2-51.2 51.2C246.4 470.4 224 448 224 419.2zM320 284.8c0-22.4 19.2-41.6 41.6-41.6 22.4 0 41.6 19.2 41.6 41.6 0 22.4-19.2 41.6-41.6 41.6C339.2 326.4 320 307.2 320 284.8zM457.6 208c0-12.8 12.8-25.6 25.6-25.6 12.8 0 25.6 12.8 25.6 25.6 0 12.8-12.8 25.6-25.6 25.6C470.4 233.6 457.6 220.8 457.6 208zM128 505.6C128 592 153.6 672 201.6 736c28.8-60.8 112-60.8 124.8-60.8-16-51.2 16-99.2 16-99.2l316.8-422.4c-48-19.2-99.2-32-150.4-32C297.6 118.4 128 291.2 128 505.6zM764.8 86.4c-22.4 19.2-390.4 518.4-390.4 518.4-22.4 28.8-12.8 76.8 22.4 99.2l9.6 6.4c35.2 22.4 80 12.8 99.2-25.6 0 0 6.4-12.8 9.6-19.2 54.4-105.6 275.2-524.8 288-553.6 6.4-19.2-3.2-32-19.2-32C777.6 76.8 771.2 80 764.8 86.4z"})]);eu.displayName="OutlookIcon";var tu=M({name:"AppearanceSwitch",setup(){const{config:e,isDarkmode:t,status:n}=fl(),l=an(),r=()=>{e.value==="switch"?n.value={light:"dark",dark:"auto",auto:"light"}[n.value]:n.value=n.value==="light"?"dark":"light"},a=async s=>{if(!(document.startViewTransition&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!l.value)||!s){r();return}const o=s.clientX,c=s.clientY,u=Math.hypot(Math.max(o,innerWidth-o),Math.max(c,innerHeight-c)),d=t.value;await document.startViewTransition(async()=>{r(),await ln()}).ready,t.value!==d&&document.documentElement.animate({clipPath:t.value?[`circle(${u}px at ${o}px ${c}px)`,`circle(0px at ${o}px ${c}px)`]:[`circle(0px at ${o}px ${c}px)`,`circle(${u}px at ${o}px ${c}px)`]},{duration:400,pseudoElement:t.value?"::view-transition-old(root)":"::view-transition-new(root)"})};return()=>i("button",{type:"button",id:"appearance-switch",onClick:a},[i(Zc,{style:{display:n.value==="auto"?"block":"none"}}),i(Jc,{style:{display:n.value==="dark"?"block":"none"}}),i(Yc,{style:{display:n.value==="light"?"block":"none"}})])}}),b2=M({name:"AppearanceMode",setup(){const e=oe(),{canToggle:t}=fl(),n=_(()=>e.value.outlookLocales.darkmode);return()=>t.value?i("div",{class:"appearance-wrapper"},[i("label",{class:"appearance-title",for:"appearance-switch"},n.value),i(tu)]):null}});const Or="VUEPRESS_THEME_COLOR";var y2=M({name:"ThemeColorPicker",props:{themeColor:{type:Object,required:!0}},setup(e){const t=(n="")=>{const l=document.documentElement.classList,r=bt(e.themeColor);if(!n){localStorage.removeItem(Or),l.remove(...r);return}l.remove(...r.filter(a=>a!==n)),l.add(n),localStorage.setItem(Or,n)};return Ee(()=>{const n=localStorage.getItem(Or);n&&t(n)}),()=>i("ul",{id:"theme-color-picker"},[i("li",i("span",{class:"theme-color",onClick:()=>t()})),Sn(e.themeColor).map(([n,l])=>i("li",i("span",{style:{background:l},onClick:()=>t(n)})))])}});const gn=Fa.enableThemeColor==="true",_2=gn?Zf(Sn(Fa).filter(([e])=>e.startsWith("theme-"))):{};var E2=M({name:"ThemeColor",setup(){const e=oe(),t=_(()=>e.value.outlookLocales.themeColor);return()=>gn?i("div",{class:"theme-color-wrapper"},[i("label",{class:"theme-color-title",for:"theme-color-picker"},t.value),i(y2,{themeColor:_2})]):null}}),nu=M({name:"ToggleFullScreenButton",setup(){const e=oe(),{isSupported:t,isFullscreen:n,toggle:l}=Ma(),r=_(()=>e.value.outlookLocales.fullscreen);return()=>t?i("div",{class:"full-screen-wrapper"},[i("label",{class:"full-screen-title",for:"full-screen-switch"},r.value),i("button",{type:"button",id:"full-screen-switch",class:"full-screen",ariaPressed:n.value,onClick:()=>l()},n.value?i(Xc):i(Qc))]):null}}),lu=M({name:"OutlookSettings",setup(){const e=qt(),t=an(),n=_(()=>!t.value&&e.value.fullscreen);return()=>i(ar,()=>[gn?i(E2):null,i(b2),n.value?i(nu):null])}}),k2=M({name:"NavScreen",props:{show:Boolean},emits:["close"],slots:Object,setup(e,{emit:t,slots:n}){const l=ie(),{isMobile:r}=pl(),a=lt(),s=wc(a);return Ee(()=>{a.value=document.body,me(r,o=>{!o&&e.show&&(s.value=!1,t("close"))}),me(()=>l.value.path,()=>{s.value=!1,t("close")})}),lr(()=>{s.value=!1}),()=>i(jt,{name:"fade",onEnter:()=>{s.value=!0},onAfterLeave:()=>{s.value=!1}},()=>{var o,c;return e.show?i("div",{id:"nav-screen"},i("div",{class:"vp-nav-screen-container"},[(o=n.before)==null?void 0:o.call(n),i(g2),i("div",{class:"vp-outlook-wrapper"},i(lu)),(c=n.after)==null?void 0:c.call(n)])):null})}}),w2=M({name:"NavbarBrand",setup(){const e=yt(),t=il(),n=oe(),l=_(()=>n.value.home||e.value),r=_(()=>t.value.title),a=_(()=>n.value.navTitle??r.value),s=_(()=>n.value.logo?xe(n.value.logo):null),o=_(()=>n.value.logoDark?xe(n.value.logoDark):null);return()=>i(Ce,{to:l.value,class:"vp-brand"},()=>[s.value?i("img",{class:["vp-nav-logo",{light:!!o.value}],src:s.value,alt:""}):null,o.value?i("img",{class:["vp-nav-logo dark"],src:o.value,alt:""}):null,a.value?i("span",{class:["vp-site-name",{"hide-in-pad":s.value&&n.value.hideSiteNameOnMobile!==!1}]},a.value):null])}}),A2=M({name:"NavbarLinks",setup(){const e=Kc();return()=>e.value.length?i("nav",{class:"vp-nav-links"},e.value.map(t=>i("div",{class:"nav-item hide-in-mobile"},"children"in t?i(h2,{config:t}):i(ze,{config:t})))):null}}),x2=M({name:"RepoLink",components:{BitbucketIcon:hc,GiteeIcon:fc,GitHubIcon:dc,GitLabIcon:pc,SourceIcon:vc},setup(){const e=v2();return()=>e.value?i("div",{class:"nav-item vp-repo"},i("a",{class:"vp-repo-link",href:e.value.link,target:"_blank",rel:"noopener noreferrer","aria-label":e.value.label},i(Ke(`${e.value.type}Icon`),{style:{width:"1.25rem",height:"1.25rem",verticalAlign:"middle"}}))):null}});const ru=({active:e=!1},{emit:t})=>i("button",{type:"button",class:["vp-toggle-navbar-button",{"is-active":e}],"aria-label":"Toggle Navbar","aria-expanded":e,"aria-controls":"nav-screen",onClick:()=>t("toggle")},i("span",[i("span",{class:"vp-top"}),i("span",{class:"vp-middle"}),i("span",{class:"vp-bottom"})]));ru.displayName="ToggleNavbarButton";var L2=ru;const Xr=(e,{emit:t})=>i("button",{type:"button",class:"vp-toggle-sidebar-button",title:"Toggle Sidebar",onClick:()=>t("toggle")},i("span",{class:"icon"}));Xr.displayName="ToggleSidebarButton",Xr.emits=["toggle"];var T2=Xr,S2=M({name:"OutlookButton",setup(){const{isSupported:e}=Ma(),t=qt(),n=an(),l=ie(),{canToggle:r}=fl(),a=J(!1),s=_(()=>!n.value&&t.value.fullscreen&&e);return me(()=>l.value.path,()=>{a.value=!1}),()=>r.value||s.value||gn?i("div",{class:"nav-item hide-in-mobile"},r.value&&!s.value&&!gn?i(tu):s.value&&!r.value&&!gn?i(nu):i("button",{type:"button",class:["outlook-button",{open:a.value}],tabindex:"-1","aria-hidden":!0},[i(eu),i("div",{class:"outlook-dropdown"},i(lu))])):null}}),C2=M({name:"NavBar",emits:["toggleSidebar"],slots:Object,setup(e,{emit:t,slots:n}){const l=oe(),{isMobile:r}=pl(),a=J(!1),s=_(()=>{const{navbarAutoHide:d="mobile"}=l.value;return d!=="none"&&(d==="always"||r.value)}),o=_(()=>l.value.navbarLayout||{start:["Brand"],center:["Links"],end:["Language","Repo","Outlook","Search"]}),c={Brand:w2,Language:Rr,Links:A2,Repo:x2,Outlook:S2,Search:ut("Docsearch")?Ke("Docsearch"):ut("SearchBox")?Ke("SearchBox"):Rr},u=d=>c[d]??(ut(d)?Ke(d):Rr);return()=>{var d,p,f,h,g,E;return[i("header",{id:"navbar",class:["vp-navbar",{"auto-hide":s.value,"hide-icon":l.value.navbarIcon===!1}]},[i("div",{class:"vp-navbar-start"},[i(T2,{onToggle:()=>{a.value&&(a.value=!1),t("toggleSidebar")}}),(d=n.startBefore)==null?void 0:d.call(n),(o.value.start||[]).map(k=>i(u(k))),(p=n.startAfter)==null?void 0:p.call(n)]),i("div",{class:"vp-navbar-center"},[(f=n.centerBefore)==null?void 0:f.call(n),(o.value.center||[]).map(k=>i(u(k))),(h=n.centerAfter)==null?void 0:h.call(n)]),i("div",{class:"vp-navbar-end"},[(g=n.endBefore)==null?void 0:g.call(n),(o.value.end||[]).map(k=>i(u(k))),(E=n.endAfter)==null?void 0:E.call(n),i(L2,{active:a.value,onToggle:()=>{a.value=!a.value}})])]),i(k2,{show:a.value,onClose:()=>{a.value=!1}},{before:()=>{var k;return(k=n.screenTop)==null?void 0:k.call(n)},after:()=>{var k;return(k=n.screenBottom)==null?void 0:k.call(n)}})]}}}),B2=M({name:"SidebarChild",props:{config:{type:Object,required:!0}},setup(e){const t=rt();return()=>[Hc(e.config,{class:["vp-sidebar-link",`vp-sidebar-${e.config.type}`,{active:An(t,e.config,!0)}],exact:!0}),zc(e.config.children)]}}),I2=M({name:"SidebarGroup",props:{config:{type:Object,required:!0},open:{type:Boolean,required:!0}},emits:["toggle"],setup(e,{emit:t}){const n=rt(),l=_(()=>An(n,e.config)),r=_(()=>An(n,e.config,!0));return()=>{const{collapsible:a,children:s=[],icon:o,prefix:c,link:u,text:d}=e.config;return i("section",{class:"vp-sidebar-group"},[i(a?"button":"p",{class:["vp-sidebar-heading",{clickable:a||u,exact:r.value,active:l.value}],...a?{type:"button",onClick:()=>t("toggle"),onKeydown:p=>{p.key==="Enter"&&t("toggle")}}:{}},[i(Ne,{icon:o}),u?i(ze,{class:"vp-sidebar-title",config:{text:d,link:u},noExternalLinkIcon:!0}):i("span",{class:"vp-sidebar-title"},d),a?i("span",{class:["vp-arrow",e.open?"down":"end"]}):null]),e.open||!a?i(au,{key:c,config:s}):null])}}}),au=M({name:"SidebarLinks",props:{config:{type:Array,required:!0}},setup(e){const t=rt(),n=J(-1),l=r=>{n.value=r===n.value?-1:r};return me(()=>t.path,()=>{const r=e.config.findIndex(a=>jc(t,a));n.value=r},{immediate:!0,flush:"post"}),()=>i("ul",{class:"vp-sidebar-links"},e.config.map((r,a)=>i("li",r.type==="group"?i(I2,{config:r,open:a===n.value,onToggle:()=>l(a)}):i(B2,{config:r}))))}}),R2=M({name:"SideBar",slots:Object,setup(e,{slots:t}){const n=rt(),l=oe(),r=ja(),a=lt();return Ee(()=>{me(()=>n.hash,s=>{const o=document.querySelector(`.vp-sidebar a.vp-sidebar-link[href="${n.path}${s}"]`);if(!o)return;const{top:c,height:u}=a.value.getBoundingClientRect(),{top:d,height:p}=o.getBoundingClientRect();dc+u&&o.scrollIntoView(!1)},{immediate:!0})}),()=>{var s,o,c;return i("aside",{ref:a,id:"sidebar",class:["vp-sidebar",{"hide-icon":l.value.sidebarIcon===!1}]},[(s=t.top)==null?void 0:s.call(t),((o=t.default)==null?void 0:o.call(t))||i(au,{config:r.value}),(c=t.bottom)==null?void 0:c.call(t)])}}}),Ha=M({name:"CommonWrapper",props:{containerClass:{type:String,default:""},noNavbar:Boolean,noSidebar:Boolean,noToc:Boolean},slots:Object,setup(e,{slots:t}){const n=Me(),l=ie(),r=be(),a=oe(),{isMobile:s,isPC:o}=pl(),[c,u]=ai(!1),[d,p]=ai(!1),f=ja(),h=J(!1),g=_(()=>e.noNavbar||r.value.navbar===!1||a.value.navbar===!1?!1:!!(l.value.title||a.value.logo||a.value.repo||a.value.navbar)),E=_(()=>e.noSidebar?!1:r.value.sidebar!==!1&&f.value.length!==0&&!r.value.home),k=_(()=>e.noToc||r.value.home?!1:r.value.toc||a.value.toc!==!1&&r.value.toc!==!1),b={x:0,y:0},L=x=>{b.x=x.changedTouches[0].clientX,b.y=x.changedTouches[0].clientY},y=x=>{const G=x.changedTouches[0].clientX-b.x,F=x.changedTouches[0].clientY-b.y;Math.abs(G)>Math.abs(F)*1.5&&Math.abs(G)>40&&(G>0&&b.x<=80?u(!0):u(!1))},T=()=>window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;let P=0;return De("scroll",hh(()=>{const x=T();x<=58||x{x||u(!1)}),Ee(()=>{const x=wc(document.body);me(c,F=>{x.value=F});const G=n.afterEach(()=>{u(!1)});lr(()=>{x.value=!1,G()})}),()=>i(ut("GlobalEncrypt")?Ke("GlobalEncrypt"):nc,()=>i("div",{class:["theme-container",{"no-navbar":!g.value,"no-sidebar":!E.value&&!(t.sidebar||t.sidebarTop||t.sidebarBottom),"has-toc":k.value,"hide-navbar":h.value,"sidebar-collapsed":!s.value&&!o.value&&d.value,"sidebar-open":s.value&&c.value},e.containerClass,r.value.containerClass||""],onTouchStart:L,onTouchEnd:y},[g.value?i(C2,{onToggleSidebar:()=>u()},{startBefore:()=>{var x;return(x=t.navbarStartBefore)==null?void 0:x.call(t)},startAfter:()=>{var x;return(x=t.navbarStartAfter)==null?void 0:x.call(t)},centerBefore:()=>{var x;return(x=t.navbarCenterBefore)==null?void 0:x.call(t)},centerAfter:()=>{var x;return(x=t.navbarCenterAfter)==null?void 0:x.call(t)},endBefore:()=>{var x;return(x=t.navbarEndBefore)==null?void 0:x.call(t)},endAfter:()=>{var x;return(x=t.navbarEndAfter)==null?void 0:x.call(t)},screenTop:()=>{var x;return(x=t.navScreenTop)==null?void 0:x.call(t)},screenBottom:()=>{var x;return(x=t.navScreenBottom)==null?void 0:x.call(t)}}):null,i(jt,{name:"fade"},()=>c.value?i("div",{class:"vp-sidebar-mask",onClick:()=>u(!1)}):null),i(jt,{name:"fade"},()=>s.value?null:i("div",{class:"toggle-sidebar-wrapper",onClick:()=>p()},i("span",{class:["arrow",d.value?"end":"start"]}))),i(R2,{},{...t.sidebar?{default:()=>t.sidebar()}:{},top:()=>{var x;return(x=t.sidebarTop)==null?void 0:x.call(t)},bottom:()=>{var x;return(x=t.sidebarBottom)==null?void 0:x.call(t)}}),t.default(),i(f2)]))}}),fe=M({name:"DropTransition",props:{type:{type:String,default:"single"},delay:{type:Number,default:0},duration:{type:Number,default:.25},appear:Boolean},slots:Object,setup(e,{slots:t}){const n=r=>{r.style.transition=`transform ${e.duration}s ease-in-out ${e.delay}s, opacity ${e.duration}s ease-in-out ${e.delay}s`,r.style.transform="translateY(-20px)",r.style.opacity="0"},l=r=>{r.style.transform="translateY(0)",r.style.opacity="1"};return()=>i(e.type==="single"?jt:Io,{name:"drop",appear:e.appear,onAppear:n,onAfterAppear:l,onEnter:n,onAfterEnter:l,onBeforeLeave:n},()=>t.default())}});const ea=({custom:e})=>i(zo,{class:["theme-hope-content",{custom:e}]});ea.displayName="MarkdownContent",ea.props={custom:Boolean};var za=ea;const su=()=>i(ue,{name:"author"},()=>i("path",{d:"M649.6 633.6c86.4-48 147.2-144 147.2-249.6 0-160-128-288-288-288s-288 128-288 288c0 108.8 57.6 201.6 147.2 249.6-121.6 48-214.4 153.6-240 288-3.2 9.6 0 19.2 6.4 25.6 3.2 9.6 12.8 12.8 22.4 12.8h704c9.6 0 19.2-3.2 25.6-12.8 6.4-6.4 9.6-16 6.4-25.6-25.6-134.4-121.6-240-243.2-288z"}));su.displayName="AuthorIcon";const iu=()=>i(ue,{name:"calendar"},()=>i("path",{d:"M716.4 110.137c0-18.753-14.72-33.473-33.472-33.473-18.753 0-33.473 14.72-33.473 33.473v33.473h66.993v-33.473zm-334.87 0c0-18.753-14.72-33.473-33.473-33.473s-33.52 14.72-33.52 33.473v33.473h66.993v-33.473zm468.81 33.52H716.4v100.465c0 18.753-14.72 33.473-33.472 33.473a33.145 33.145 0 01-33.473-33.473V143.657H381.53v100.465c0 18.753-14.72 33.473-33.473 33.473a33.145 33.145 0 01-33.473-33.473V143.657H180.6A134.314 134.314 0 0046.66 277.595v535.756A134.314 134.314 0 00180.6 947.289h669.74a134.36 134.36 0 00133.94-133.938V277.595a134.314 134.314 0 00-133.94-133.938zm33.473 267.877H147.126a33.145 33.145 0 01-33.473-33.473c0-18.752 14.72-33.473 33.473-33.473h736.687c18.752 0 33.472 14.72 33.472 33.473a33.145 33.145 0 01-33.472 33.473z"}));iu.displayName="CalendarIcon";const ou=()=>i(ue,{name:"category"},()=>i("path",{d:"M148.41 106.992h282.176c22.263 0 40.31 18.048 40.31 40.31V429.48c0 22.263-18.047 40.31-40.31 40.31H148.41c-22.263 0-40.311-18.047-40.311-40.31V147.302c0-22.263 18.048-40.31 40.311-40.31zM147.556 553.478H429.73c22.263 0 40.311 18.048 40.311 40.31v282.176c0 22.263-18.048 40.312-40.31 40.312H147.555c-22.263 0-40.311-18.049-40.311-40.312V593.79c0-22.263 18.048-40.311 40.31-40.311zM593.927 106.992h282.176c22.263 0 40.31 18.048 40.31 40.31V429.48c0 22.263-18.047 40.31-40.31 40.31H593.927c-22.263 0-40.311-18.047-40.311-40.31V147.302c0-22.263 18.048-40.31 40.31-40.31zM730.22 920.502H623.926c-40.925 0-74.22-33.388-74.22-74.425V623.992c0-41.038 33.387-74.424 74.425-74.424h222.085c41.038 0 74.424 33.226 74.424 74.067v114.233c0 10.244-8.304 18.548-18.547 18.548s-18.548-8.304-18.548-18.548V623.635c0-20.388-16.746-36.974-37.33-36.974H624.13c-20.585 0-37.331 16.747-37.331 37.33v222.086c0 20.585 16.654 37.331 37.126 37.331H730.22c10.243 0 18.547 8.304 18.547 18.547 0 10.244-8.304 18.547-18.547 18.547z"}));ou.displayName="CategoryIcon";const cu=()=>i(ue,{name:"print"},()=>i("path",{d:"M819.2 364.8h-44.8V128c0-17.067-14.933-32-32-32H281.6c-17.067 0-32 14.933-32 32v236.8h-44.8C145.067 364.8 96 413.867 96 473.6v192c0 59.733 49.067 108.8 108.8 108.8h44.8V896c0 17.067 14.933 32 32 32h460.8c17.067 0 32-14.933 32-32V774.4h44.8c59.733 0 108.8-49.067 108.8-108.8v-192c0-59.733-49.067-108.8-108.8-108.8zM313.6 160h396.8v204.8H313.6V160zm396.8 704H313.6V620.8h396.8V864zM864 665.6c0 25.6-19.2 44.8-44.8 44.8h-44.8V588.8c0-17.067-14.933-32-32-32H281.6c-17.067 0-32 14.933-32 32v121.6h-44.8c-25.6 0-44.8-19.2-44.8-44.8v-192c0-25.6 19.2-44.8 44.8-44.8h614.4c25.6 0 44.8 19.2 44.8 44.8v192z"}));cu.displayName="PrintIcon";const uu=()=>i(ue,{name:"tag"},()=>i("path",{d:"M939.902 458.563L910.17 144.567c-1.507-16.272-14.465-29.13-30.737-30.737L565.438 84.098h-.402c-3.215 0-5.726 1.005-7.634 2.913l-470.39 470.39a10.004 10.004 0 000 14.164l365.423 365.424c1.909 1.908 4.42 2.913 7.132 2.913s5.223-1.005 7.132-2.913l470.39-470.39c2.01-2.11 3.014-5.023 2.813-8.036zm-240.067-72.121c-35.458 0-64.286-28.828-64.286-64.286s28.828-64.285 64.286-64.285 64.286 28.828 64.286 64.285-28.829 64.286-64.286 64.286z"}));uu.displayName="TagIcon";const du=()=>i(ue,{name:"timer"},()=>i("path",{d:"M799.387 122.15c4.402-2.978 7.38-7.897 7.38-13.463v-1.165c0-8.933-7.38-16.312-16.312-16.312H256.33c-8.933 0-16.311 7.38-16.311 16.312v1.165c0 5.825 2.977 10.874 7.637 13.592 4.143 194.44 97.22 354.963 220.201 392.763-122.204 37.542-214.893 196.511-220.2 389.397-4.661 5.049-7.638 11.651-7.638 19.03v5.825h566.49v-5.825c0-7.379-2.849-13.981-7.509-18.9-5.049-193.016-97.867-351.985-220.2-389.527 123.24-37.67 216.446-198.453 220.588-392.892zM531.16 450.445v352.632c117.674 1.553 211.787 40.778 211.787 88.676H304.097c0-48.286 95.149-87.382 213.728-88.676V450.445c-93.077-3.107-167.901-81.297-167.901-177.093 0-8.803 6.99-15.793 15.793-15.793 8.803 0 15.794 6.99 15.794 15.793 0 80.261 63.69 145.635 142.01 145.635s142.011-65.374 142.011-145.635c0-8.803 6.99-15.793 15.794-15.793s15.793 6.99 15.793 15.793c0 95.019-73.789 172.82-165.96 177.093z"}));du.displayName="TimerIcon";const pu=()=>i(ue,{name:"word"},()=>[i("path",{d:"M518.217 432.64V73.143A73.143 73.143 0 01603.43 1.097a512 512 0 01419.474 419.474 73.143 73.143 0 01-72.046 85.212H591.36a73.143 73.143 0 01-73.143-73.143z"}),i("path",{d:"M493.714 566.857h340.297a73.143 73.143 0 0173.143 85.577A457.143 457.143 0 11371.566 117.76a73.143 73.143 0 0185.577 73.143v339.383a36.571 36.571 0 0036.571 36.571z"})]);pu.displayName="WordIcon";const Wt=()=>{const e=oe();return _(()=>e.value.metaLocales)};var O2=M({name:"AuthorInfo",inheritAttrs:!1,props:{author:{type:Array,required:!0},pure:Boolean},setup(e){const t=Wt();return()=>e.author.length?i("span",{class:"page-author-info","aria-label":`${t.value.author}${e.pure?"":"🖊"}`,...e.pure?{}:{"data-balloon-pos":"down"}},[i(su),i("span",e.author.map(n=>n.url?i("a",{class:"page-author-item",href:n.url,target:"_blank",rel:"noopener noreferrer"},n.name):i("span",{class:"page-author-item"},n.name))),i("span",{property:"author",content:e.author.map(n=>n.name).join(", ")})]):null}}),P2=M({name:"CategoryInfo",inheritAttrs:!1,props:{category:{type:Array,required:!0},pure:Boolean},setup(e){const t=Me(),n=ie(),l=Wt(),r=(a,s="")=>{s&&n.value.path!==s&&(a.preventDefault(),t.push(s))};return()=>e.category.length?i("span",{class:"page-category-info","aria-label":`${l.value.category}${e.pure?"":"🌈"}`,...e.pure?{}:{"data-balloon-pos":"down"}},[i(ou),e.category.map(({name:a,path:s})=>i("span",{class:["page-category-item",{[`category${or(a,9)}`]:!e.pure,clickable:s}],role:s?"navigation":"",onClick:o=>r(o,s)},a)),i("meta",{property:"articleSection",content:e.category.map(({name:a})=>a).join(",")})]):null}}),D2=M({name:"DateInfo",inheritAttrs:!1,props:{date:{type:Object,default:null},localizedDate:{type:String,default:""},pure:Boolean},setup(e){const t=Sa(),n=Wt();return()=>e.date?i("span",{class:"page-date-info","aria-label":`${n.value.date}${e.pure?"":"📅"}`,...e.pure?{}:{"data-balloon-pos":"down"}},[i(iu),i("span",i(ar,()=>e.localizedDate||e.date.toLocaleDateString(t.value))),i("meta",{property:"datePublished",content:e.date.toISOString()||""})]):null}}),M2=M({name:"OriginalInfo",inheritAttrs:!1,props:{isOriginal:Boolean},setup(e){const t=Wt();return()=>e.isOriginal?i("span",{class:"page-original-info"},t.value.origin):null}}),$2=M({name:"ReadingTimeInfo",inheritAttrs:!1,props:{readingTime:{type:Object,default:()=>null},readingTimeLocale:{type:Object,default:()=>null},pure:Boolean},setup(e){const t=Wt(),n=_(()=>{if(!e.readingTime)return null;const{minutes:l}=e.readingTime;return l<1?"PT1M":`PT${Math.round(l)}M`});return()=>{var l,r;return(l=e.readingTimeLocale)!=null&&l.time?i("span",{class:"page-reading-time-info","aria-label":`${t.value.readingTime}${e.pure?"":"⌛"}`,...e.pure?{}:{"data-balloon-pos":"down"}},[i(du),i("span",(r=e.readingTimeLocale)==null?void 0:r.time),i("meta",{property:"timeRequired",content:n.value})]):null}}}),F2=M({name:"TagInfo",inheritAttrs:!1,props:{tag:{type:Array,default:()=>[]},pure:Boolean},setup(e){const t=Me(),n=ie(),l=Wt(),r=(a,s="")=>{s&&n.value.path!==s&&(a.preventDefault(),t.push(s))};return()=>e.tag.length?i("span",{class:"page-tag-info","aria-label":`${l.value.tag}${e.pure?"":"🏷"}`,...e.pure?{}:{"data-balloon-pos":"down"}},[i(uu),e.tag.map(({name:a,path:s})=>i("span",{class:["page-tag-item",{[`tag${or(a,9)}`]:!e.pure,clickable:s}],role:s?"navigation":"",onClick:o=>r(o,s)},a)),i("meta",{property:"keywords",content:e.tag.map(({name:a})=>a).join(",")})]):null}}),V2=M({name:"ReadTimeInfo",inheritAttrs:!1,props:{readingTime:{type:Object,default:()=>null},readingTimeLocale:{type:Object,default:()=>null},pure:Boolean},setup(e){const t=Wt();return()=>{var n,l,r;return(n=e.readingTimeLocale)!=null&&n.words?i("span",{class:"page-word-info","aria-label":`${t.value.words}${e.pure?"":"🔠"}`,...e.pure?{}:{"data-balloon-pos":"down"}},[i(pu),i("span",(l=e.readingTimeLocale)==null?void 0:l.words),i("meta",{property:"wordCount",content:(r=e.readingTime)==null?void 0:r.words})]):null}}}),fu=M({name:"PageInfo",components:{AuthorInfo:O2,CategoryInfo:P2,DateInfo:D2,OriginalInfo:M2,PageViewInfo:()=>null,ReadingTimeInfo:$2,TagInfo:F2,WordInfo:V2},props:{items:{type:[Array,Boolean],default:()=>["Author","Original","Date","PageView","ReadingTime","Category","Tag"]},info:{type:Object,required:!0}},setup(e){const t=an();return()=>e.items?i("div",{class:"page-info"},e.items.map(n=>i(Ke(`${n}Info`),{...e.info,pure:t.value}))):null}}),N2=M({name:"PrintButton",setup(){const e=qt(),t=oe();return()=>e.value.print===!1?null:i("button",{type:"button",class:"print-button",title:t.value.metaLocales.print,onClick:()=>{window.print()}},i(cu))}});const j2=({title:e,level:t,slug:n})=>i(Ce,{to:`#${n}`,class:["toc-link",`level${t}`]},()=>e),ta=(e,t)=>{const n=rt();return e.length&&t>0?i("ul",{class:"toc-list"},e.map(l=>{const r=ta(l.children,t-1);return[i("li",{class:["toc-item",{active:n.hash===`#${l.slug}`}]},j2(l)),r?i("li",r):null]})):null};var hu=M({name:"TOC",props:{items:{type:Array,default:()=>[]},headerDepth:{type:Number,default:2}},slots:Object,setup(e,{slots:t}){const n=rt(),l=ie(),r=Wt(),a=lt(),s=J("-1.7rem"),o=u=>{var d;(d=a.value)==null||d.scrollTo({top:u,behavior:"smooth"})},c=()=>{if(a.value){const u=document.querySelector(".toc-item.active");u?s.value=`${u.getBoundingClientRect().top-a.value.getBoundingClientRect().top+a.value.scrollTop}px`:s.value="-1.7rem"}else s.value="-1.7rem"};return Ee(()=>{me(()=>n.hash,u=>{if(a.value){const d=document.querySelector(`#toc a.toc-link[href$="${u}"]`);if(!d)return;const{top:p,height:f}=a.value.getBoundingClientRect(),{top:h,height:g}=d.getBoundingClientRect();hp+f&&o(a.value.scrollTop+h+g-p-f)}}),me(()=>n.fullPath,c,{flush:"post",immediate:!0})}),()=>{var d,p;const u=e.items.length?ta(e.items,e.headerDepth):l.value.headers?ta(l.value.headers,e.headerDepth):null;return u?i("div",{class:"toc-place-holder"},[i("aside",{id:"toc"},[(d=t.before)==null?void 0:d.call(t),i("div",{class:"toc-header"},[r.value.toc,i(N2)]),i("div",{class:"toc-wrapper",ref:a},[u,i("div",{class:"toc-marker",style:{top:s.value}})]),(p=t.after)==null?void 0:p.call(t)])]):null}}}),qa=M({name:"SkipLink",props:{content:{type:String,default:"main-content"}},setup(e){const t=ie(),n=oe(),l=lt(),r=({target:a})=>{const s=document.querySelector(a.hash);if(s){const o=()=>{s.removeAttribute("tabindex"),s.removeEventListener("blur",o)};s.setAttribute("tabindex","-1"),s.addEventListener("blur",o),s.focus(),window.scrollTo(0,0)}};return Ee(()=>{me(()=>t.value.path,()=>l.value.focus())}),()=>[i("span",{ref:l,tabindex:"-1"}),i("a",{href:`#${e.content}`,class:"vp-skip-link sr-only",onClick:r},n.value.routeLocales.skipToContent)]}});let Pr=null,Dn=null;const H2={wait:()=>Pr,pending:()=>{Pr=new Promise(e=>Dn=e)},resolve:()=>{Dn==null||Dn(),Pr=null,Dn=null}},vu=()=>H2;var z2=M({name:"FadeSlideY",slots:Object,setup(e,{slots:t}){const{resolve:n,pending:l}=vu();return()=>i(jt,{name:"fade-slide-y",mode:"out-in",onBeforeEnter:n,onBeforeLeave:l},()=>{var r;return(r=t.default)==null?void 0:r.call(t)})}});const q2=(e,t)=>{const n=e.replace(t,"/").split("/"),l=[];let r=Ta(t);return n.forEach((a,s)=>{s!==n.length-1?(r+=`${a}/`,l.push({link:r,name:a||"Home"})):a!==""&&(r+=a,l.push({link:r,name:a}))}),l},mu=(e,{slots:t})=>{var p,f;const{bgImage:n,bgImageDark:l,bgImageStyle:r,color:a,description:s,image:o,imageDark:c,header:u,features:d=[]}=e;return i("div",{class:"vp-feature-wrapper"},[n?i("div",{class:["vp-feature-bg",{light:l}],style:[{"background-image":`url(${n})`},r]}):null,l?i("div",{class:"vp-feature-bg dark",style:[{"background-image":`url(${l})`},r]}):null,i("div",{class:"vp-feature",style:a?{color:a}:{}},[((p=t.image)==null?void 0:p.call(t,e))||[o?i("img",{class:["vp-feature-image",{light:c}],src:xe(o),alt:""}):null,c?i("img",{class:"vp-feature-image dark",src:xe(c),alt:""}):null],((f=t.info)==null?void 0:f.call(t,e))||[u?i("h2",{class:"vp-feature-header"},u):null,s?i("p",{class:"vp-feature-description",innerHTML:s}):null],d.length?i("div",{class:"vp-features"},d.map(({icon:h,title:g,details:E,link:k})=>{const b=[i("h3",{class:"vp-feature-title"},[i(Ne,{icon:h}),i("span",{innerHTML:g})]),i("p",{class:"vp-feature-details",innerHTML:E})];return k?Gl(k)?i("a",{class:"vp-feature-item link",href:k,"aria-label":g,target:"_blank"},b):i(Ce,{class:"vp-feature-item link",to:k,"aria-label":g},()=>b):i("div",{class:"vp-feature-item"},b)})):null])])};mu.displayName="FeaturePanel";var yi=mu;const gu=e=>{const{icon:t="",color:n,size:l}=e,r={};return n&&(r.color=n),l&&(r.height=Number.isNaN(Number(l))?l:`${l}px`),rn(t)?i("img",{class:"icon",src:t,"no-view":"",style:r}):Cn(t)?i("img",{class:"icon",src:xe(t),"aria-hidden":"","no-view":"",style:r}):i(Ke("FontIcon"),e)};gu.displayName="HopeIcon";var W2=gu,G2=M({name:"HeroInfo",slots:Object,setup(e,{slots:t}){const n=be(),l=il(),r=_(()=>n.value.heroFullScreen??!1),a=_(()=>{const{heroText:u,tagline:d}=n.value;return{text:u??l.value.title??"Hello",tagline:d??l.value.description??"",isFullScreen:r.value}}),s=_(()=>{const{heroText:u,heroImage:d,heroImageDark:p,heroAlt:f,heroImageStyle:h}=n.value;return{image:d?xe(d):null,imageDark:p?xe(p):null,heroStyle:h,alt:f||u||"",isFullScreen:r.value}}),o=_(()=>{const{bgImage:u,bgImageDark:d,bgImageStyle:p}=n.value;return{image:gt(u)?xe(u):null,imageDark:gt(d)?xe(d):null,bgStyle:p,isFullScreen:r.value}}),c=_(()=>n.value.actions??[]);return()=>{var u,d,p;return i("header",{class:["vp-hero-info-wrapper",{fullscreen:r.value}]},[((u=t.heroBg)==null?void 0:u.call(t,o.value))||[o.value.image?i("div",{class:["vp-hero-mask",{light:o.value.imageDark}],style:[{"background-image":`url(${o.value.image})`},o.value.bgStyle]}):null,o.value.imageDark?i("div",{class:"vp-hero-mask dark",style:[{"background-image":`url(${o.value.imageDark})`},o.value.bgStyle]}):null],i("div",{class:"vp-hero-info"},[((d=t.heroImage)==null?void 0:d.call(t,s.value))||i(fe,{appear:!0,type:"group"},()=>[s.value.image?i("img",{key:"light",class:["vp-hero-image",{light:s.value.imageDark}],style:s.value.heroStyle,src:s.value.image,alt:s.value.alt}):null,s.value.imageDark?i("img",{key:"dark",class:"vp-hero-image dark",style:s.value.heroStyle,src:s.value.imageDark,alt:s.value.alt}):null]),((p=t.heroInfo)==null?void 0:p.call(t,a.value))??i("div",{class:"vp-hero-infos"},[a.value.text?i(fe,{appear:!0,delay:.04},()=>i("h1",{id:"main-title"},a.value.text)):null,a.value.tagline?i(fe,{appear:!0,delay:.08},()=>i("p",{id:"main-description",innerHTML:a.value.tagline})):null,c.value.length?i(fe,{appear:!0,delay:.12},()=>i("p",{class:"vp-hero-actions"},c.value.map(f=>i(ze,{class:["vp-hero-action",f.type||"default"],config:f,noExternalLinkIcon:!0},f.icon?{before:()=>i(W2,{icon:f.icon})}:{})))):null])])])}}});const bu=(e,{slots:t})=>{var f,h,g;const{bgImage:n,bgImageDark:l,bgImageStyle:r,color:a,description:s,image:o,imageDark:c,header:u,highlights:d=[],type:p="un-order"}=e;return i("div",{class:"vp-highlight-wrapper",style:a?{color:a}:{}},[n?i("div",{class:["vp-highlight-bg",{light:l}],style:[{"background-image":`url(${n})`},r]}):null,l?i("div",{class:"vp-highlight-bg dark",style:[{"background-image":`url(${l})`},r]}):null,i("div",{class:"vp-highlight"},[((f=t.image)==null?void 0:f.call(t,e))||[o?i("img",{class:["vp-highlight-image",{light:c}],src:xe(o),alt:""}):null,c?i("img",{class:"vp-highlight-image dark",src:xe(c),alt:""}):null],((h=t.info)==null?void 0:h.call(t,e))||[i("div",{class:"vp-highlight-info-wrapper"},i("div",{class:"vp-highlight-info"},[u?i("h2",{class:"vp-highlight-header",innerHTML:u}):null,s?i("p",{class:"vp-highlight-description",innerHTML:s}):null,((g=t.highlights)==null?void 0:g.call(t,d))||i(p==="order"?"ol":p==="no-order"?"dl":"ul",{class:"vp-highlights"},d.map(({icon:E,title:k,details:b,link:L})=>{const y=[i(p==="no-order"?"dt":"h3",{class:"vp-highlight-title"},[E?i(Ne,{class:"vp-highlight-icon",icon:E}):null,i("span",{innerHTML:k})]),b?i(p==="no-order"?"dd":"p",{class:"vp-highlight-details",innerHTML:b}):null];return i(p==="no-order"?"div":"li",{class:["vp-highlight-item-wrapper",{link:L}]},L?Uf(L)?i("a",{class:"vp-highlight-item link",href:L,"aria-label":k,target:"_blank"},y):i(Ce,{class:"vp-highlight-item link",to:L,"aria-label":k},()=>y):i("div",{class:"vp-highlight-item"},y))}))]))]])])};bu.displayName="HighlightPanel";var U2=bu,K2=M({name:"HomePage",slots:Object,setup(e,{slots:t}){const n=an(),l=be(),r=_(()=>{const{features:s}=l.value;return X(s)?s:null}),a=_(()=>{const{highlights:s}=l.value;return X(s)?s:null});return()=>{var s,o,c,u;return i("main",{id:"main-content",class:["vp-project-home ",{pure:n.value}],"aria-labelledby":l.value.heroText===null?"":"main-title"},[(s=t.top)==null?void 0:s.call(t),i(G2),((o=a.value)==null?void 0:o.map(d=>"features"in d?i(yi,d):i(U2,d)))||(r.value?i(fe,{appear:!0,delay:.24},()=>i(yi,{features:r.value})):null),(c=t.center)==null?void 0:c.call(t),i(fe,{appear:!0,delay:.32},()=>i(za)),(u=t.bottom)==null?void 0:u.call(t)])}}}),J2=M({name:"BreadCrumb",setup(){const e=Me(),t=ie(),n=yt(),l=be(),r=oe(),a=lt([]),s=_(()=>(l.value.breadcrumb||l.value.breadcrumb!==!1&&r.value.breadcrumb!==!1)&&a.value.length>1),o=_(()=>l.value.breadcrumbIcon||l.value.breadcrumbIcon!==!1&&r.value.breadcrumbIcon!==!1),c=()=>{const u=e.getRoutes(),d=q2(t.value.path,n.value).map(({link:p,name:f})=>{const h=u.find(g=>g.path===p);if(h){const{meta:g,path:E}=wn(e,h.path);return{title:g[_e.shortTitle]||g[_e.title]||f,icon:g[_e.icon],path:E}}return null}).filter(p=>p!==null);d.length>1&&(a.value=d)};return Ee(()=>{me(()=>t.value.path,c,{immediate:!0})}),()=>i("nav",{class:["vp-breadcrumb",{disable:!s.value}]},s.value?i("ol",{vocab:"https://schema.org/",typeof:"BreadcrumbList"},a.value.map((u,d)=>i("li",{class:{"is-active":a.value.length-1===d},property:"itemListElement",typeof:"ListItem"},[i(Ce,{to:u.path,property:"item",typeof:"WebPage"},()=>[o.value?i(Ne,{icon:u.icon}):null,i("span",{property:"name"},u.title||"Unknown")]),i("meta",{property:"position",content:d+1})]))):[])}});const _i=e=>{const t=Me();return e===!1?!1:se(e)?mn(t,e,!0):La(e)?e:null},na=(e,t,n)=>{const l=e.findIndex(r=>r.link===t);if(l!==-1){const r=e[l+n];return r!=null&&r.link?r:null}for(const r of e)if(r.children){const a=na(r.children,t,n);if(a)return a}return null};var Y2=M({name:"PageNav",setup(){const e=oe(),t=be(),n=ja(),l=ie(),r=dl(),a=_(()=>{const o=_i(t.value.prev);return o===!1?null:o||(e.value.prevLink===!1?null:na(n.value,l.value.path,-1))}),s=_(()=>{const o=_i(t.value.next);return o===!1?null:o||(e.value.nextLink===!1?null:na(n.value,l.value.path,1))});return De("keydown",o=>{o.altKey&&(o.key==="ArrowRight"?s.value&&(r(s.value.link),o.preventDefault()):o.key==="ArrowLeft"&&a.value&&(r(a.value.link),o.preventDefault()))}),()=>a.value||s.value?i("nav",{class:"vp-page-nav"},[a.value?i(ze,{class:"prev",config:a.value},()=>{var o,c;return[i("div",{class:"hint"},[i("span",{class:"arrow start"}),e.value.metaLocales.prev]),i("div",{class:"link"},[i(Ne,{icon:(o=a.value)==null?void 0:o.icon}),(c=a.value)==null?void 0:c.text])]}):null,s.value?i(ze,{class:"next",config:s.value},()=>{var o,c;return[i("div",{class:"hint"},[e.value.metaLocales.next,i("span",{class:"arrow end"})]),i("div",{class:"link"},[(o=s.value)==null?void 0:o.text,i(Ne,{icon:(c=s.value)==null?void 0:c.icon})])]}):null]):null}});const Z2={GitHub:":repo/edit/:branch/:path",GitLab:":repo/-/edit/:branch/:path",Gitee:":repo/edit/:branch/:path",Bitbucket:":repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default"},Q2=({docsRepo:e,docsBranch:t,docsDir:n,filePathRelative:l,editLinkPattern:r})=>{if(!l)return null;const a=uc(e);let s;return r?s=r:a!==null&&(s=Z2[a]),s?s.replace(/:repo/,rn(e)?e:`https://github.com/${e}`).replace(/:branch/,t).replace(/:path/,Po(`${Ta(n)}/${l}`)):null},X2=()=>{const e=oe(),t=ie(),n=be();return _(()=>{const{repo:l,docsRepo:r=l,docsBranch:a="main",docsDir:s="",editLink:o,editLinkPattern:c=""}=e.value;if(!(n.value.editLink??o??!0)||!r)return null;const u=Q2({docsRepo:r,docsBranch:a,docsDir:s,editLinkPattern:c,filePathRelative:t.value.filePathRelative});return u?{text:e.value.metaLocales.editLink,link:u}:null})},ev=()=>{const e=il(),t=oe(),n=ie(),l=be();return _(()=>{var r,a;return!(l.value.lastUpdated??t.value.lastUpdated??!0)||!((r=n.value.git)!=null&&r.updatedTime)?null:new Date((a=n.value.git)==null?void 0:a.updatedTime).toLocaleString(e.value.lang)})},tv=()=>{const e=oe(),t=ie(),n=be();return _(()=>{var l;return n.value.contributors??e.value.contributors??!0?((l=t.value.git)==null?void 0:l.contributors)??null:null})};var nv=M({name:"PageTitle",setup(){const e=ie(),t=be(),n=oe(),{info:l,items:r}=r2();return()=>i("div",{class:"vp-page-title"},[i("h1",[n.value.titleIcon===!1?null:i(Ne,{icon:t.value.icon}),e.value.title]),i(fu,{info:l.value,...r.value===null?{}:{items:r.value}}),i("hr")])}});const yu=()=>i(ue,{name:"edit"},()=>[i("path",{d:"M430.818 653.65a60.46 60.46 0 0 1-50.96-93.281l71.69-114.012 7.773-10.365L816.038 80.138A60.46 60.46 0 0 1 859.225 62a60.46 60.46 0 0 1 43.186 18.138l43.186 43.186a60.46 60.46 0 0 1 0 86.373L588.879 565.55l-8.637 8.637-117.466 68.234a60.46 60.46 0 0 1-31.958 11.229z"}),i("path",{d:"M728.802 962H252.891A190.883 190.883 0 0 1 62.008 771.98V296.934a190.883 190.883 0 0 1 190.883-192.61h267.754a60.46 60.46 0 0 1 0 120.92H252.891a69.962 69.962 0 0 0-69.098 69.099V771.98a69.962 69.962 0 0 0 69.098 69.098h475.911A69.962 69.962 0 0 0 797.9 771.98V503.363a60.46 60.46 0 1 1 120.922 0V771.98A190.883 190.883 0 0 1 728.802 962z"})]);yu.displayName="EditIcon";var lv=M({name:"PageMeta",setup(){const e=oe(),t=X2(),n=ev(),l=tv();return()=>{const{metaLocales:r}=e.value;return i("footer",{class:"page-meta"},[t.value?i("div",{class:"meta-item edit-link"},i(ze,{class:"label",config:t.value},{before:()=>i(yu)})):null,i("div",{class:"meta-item git-info"},[n.value?i("div",{class:"update-time"},[i("span",{class:"label"},`${r.lastUpdated}: `),i(ar,()=>i("span",{class:"info"},n.value))]):null,l.value&&l.value.length?i("div",{class:"contributors"},[i("span",{class:"label"},`${r.contributors}: `),l.value.map(({email:a,name:s},o)=>[i("span",{class:"contributor",title:`email: ${a}`},s),o!==l.value.length-1?",":""])]):null])])}}}),rv=M({name:"NormalPage",slots:Object,setup(e,{slots:t}){const n=be(),{isDarkmode:l}=fl(),r=oe(),a=_(()=>n.value.toc||n.value.toc!==!1&&r.value.toc!==!1);return()=>i("main",{id:"main-content",class:"vp-page"},i(ut("LocalEncrypt")?Ke("LocalEncrypt"):nc,()=>{var s,o,c,u;return[(s=t.top)==null?void 0:s.call(t),n.value.cover?i("div",{class:"page-cover"},i("img",{src:xe(n.value.cover),alt:"","no-view":""})):null,i(J2),i(nv),a.value?i(hu,{headerDepth:n.value.headerDepth??r.value.headerDepth??2},{before:()=>{var d;return(d=t.tocBefore)==null?void 0:d.call(t)},after:()=>{var d;return(d=t.tocAfter)==null?void 0:d.call(t)}}):null,(o=t.contentBefore)==null?void 0:o.call(t),i(za),(c=t.contentAfter)==null?void 0:c.call(t),i(lv),i(Y2),ut("CommentService")?i(Ke("CommentService"),{darkmode:l.value}):null,(u=t.bottom)==null?void 0:u.call(t)]}))}}),av=M({name:"Layout",slots:Object,setup(e,{slots:t}){const n=qt(),l=oe(),r=ie(),a=be(),{isMobile:s}=pl(),o=_(()=>{var c,u;return((c=l.value.blog)==null?void 0:c.sidebarDisplay)||((u=n.value.blog)==null?void 0:u.sidebarDisplay)||"mobile"});return()=>[i(qa),i(Ha,{},{default:()=>{var c;return((c=t.default)==null?void 0:c.call(t))||(a.value.home?i(K2):i(z2,()=>i(rv,{key:r.value.path},{top:()=>{var u;return(u=t.top)==null?void 0:u.call(t)},bottom:()=>{var u;return(u=t.bottom)==null?void 0:u.call(t)},contentBefore:()=>{var u;return(u=t.contentBefore)==null?void 0:u.call(t)},contentAfter:()=>{var u;return(u=t.contentAfter)==null?void 0:u.call(t)},tocBefore:()=>{var u;return(u=t.tocBefore)==null?void 0:u.call(t)},tocAfter:()=>{var u;return(u=t.tocAfter)==null?void 0:u.call(t)}})))},...o.value!=="none"?{navScreenBottom:()=>i(Ke("BloggerInfo"))}:{},...!s.value&&o.value==="always"?{sidebar:()=>i(Ke("BloggerInfo"))}:{}})]}}),sv=M({name:"NotFoundHint",setup(){const e=oe(),t=()=>{const n=e.value.routeLocales.notFoundMsg;return n[Math.floor(Math.random()*n.length)]};return()=>i("div",{class:"not-found-hint"},[i("p",{class:"error-code"},"404"),i("h1",{class:"error-title"},e.value.routeLocales.notFoundTitle),i("p",{class:"error-hint"},t())])}}),iv=M({name:"NotFound",slots:Object,setup(e,{slots:t}){const n=yt(),l=oe(),{navigate:r}=Jr({to:l.value.home??n.value});return()=>[i(qa),i(Ha,{noSidebar:!0},()=>{var a;return i("main",{id:"main-content",class:"vp-page not-found"},((a=t.default)==null?void 0:a.call(t))||[i(sv),i("div",{class:"actions"},[i("button",{type:"button",class:"action-button",onClick:()=>{window.history.go(-1)}},l.value.routeLocales.back),i("button",{type:"button",class:"action-button",onClick:()=>r()},l.value.routeLocales.home)])])})]}});const ov={Zhihu:'',Github:'',Gitee:''},cv={category:{"/":{path:"/category/",map:{}}},tag:{"/":{path:"/tag/",map:{}}}},uv={article:{"/":{path:"/article/",keys:["v-90f2343c","v-510415f9","v-3c114a75","v-d73a9aee","v-3f2a15ee","v-02bc92be","v-2e25198a","v-50cb12f2","v-37ac02fe","v-523e9724","v-65b5c81c","v-731a76b6","v-bea2ce1e","v-3efc517e","v-79ad699f","v-8658e60a","v-7e9e4a32","v-0b62f72e","v-525c5e4d","v-60fc7530","v-04e32b44","v-258f309e","v-380c630d","v-aa93dec0","v-21ba2ec8","v-3192e5a0","v-2675bfdc","v-0a0b7a54","v-79fdd481","v-8daa1a0e","v-cfe8b6c8","v-71fde78e","v-580db9be","v-06d5cd4c","v-132efcd1","v-1a2ca7a7","v-375ccf42","v-d642798c","v-473223ec","v-0b13f184","v-091223ce","v-0a27b598","v-478d0de6","v-60eda44c","v-399e07b6","v-660266c1","v-0b5d4df0","v-f48afbfc","v-21e54510","v-57ae83ac","v-22e4234a","v-1f7a720c","v-1c10c0ce","v-14e6315a","v-dc384366","v-70796e0a"]}},star:{"/":{path:"/star/",keys:[]}},timeline:{"/":{path:"/timeline/",keys:["v-90f2343c","v-510415f9","v-3c114a75","v-d73a9aee","v-3f2a15ee","v-02bc92be","v-2e25198a","v-50cb12f2","v-37ac02fe","v-523e9724","v-65b5c81c","v-731a76b6","v-bea2ce1e","v-3efc517e","v-79ad699f","v-8658e60a","v-7e9e4a32","v-0b62f72e","v-525c5e4d","v-60fc7530","v-04e32b44","v-258f309e","v-380c630d","v-aa93dec0","v-21ba2ec8","v-3192e5a0","v-2675bfdc","v-0a0b7a54","v-79fdd481","v-8daa1a0e","v-cfe8b6c8","v-71fde78e","v-580db9be","v-06d5cd4c","v-132efcd1","v-1a2ca7a7","v-375ccf42","v-d642798c","v-473223ec","v-0b13f184","v-091223ce","v-0a27b598","v-478d0de6","v-60eda44c","v-399e07b6","v-660266c1","v-0b5d4df0","v-f48afbfc","v-21e54510","v-57ae83ac","v-22e4234a","v-1f7a720c","v-1c10c0ce","v-14e6315a","v-dc384366","v-70796e0a"]}}},Ei=J(cv),_u=(e="")=>{const t=ie(),n=Me(),l=yt();return _(()=>{var c;const r=e||((c=be().value.blog)==null?void 0:c.key)||"";if(!r)return console.warn("useBlogCategory: key not found"),{path:"/",map:{}};const a=n.getRoutes();if(!Ei.value[r])throw new Error(`useBlogCategory: key ${r} is invalid`);const s=Ei.value[r][l.value],o={path:s.path,map:{}};for(const u in s.map){const d=s.map[u];o.map[u]={path:d.path,items:[]};for(const p of d.keys){const f=a.find(({name:h})=>h===p);if(f){const h=wn(n,f.path);o.map[u].items.push({path:h.path,info:h.meta})}}t.value.path===d.path&&(o.currentItems=o.map[u].items)}return o})},ki=J(uv),cr=(e="")=>{const t=Me(),n=yt();return _(()=>{var o;const l=e||((o=be().value.blog)==null?void 0:o.key)||"";if(!l)return console.warn("useBlogType: key not found"),{path:"/",items:[]};if(!ki.value[l])throw new Error(`useBlogType: key ${e} is invalid`);const r=t.getRoutes(),a=ki.value[l][n.value],s={path:a.path,items:[]};for(const c of a.keys){const u=r.find(({name:d})=>d===c);if(u){const d=wn(t,u.path);s.items.push({path:d.path,info:d.meta})}}return s})};var dv=[];const Eu=Symbol.for("categoryMap"),hl=()=>{const e=he(Eu);if(!e)throw new Error("useCategoryMap() is called without provider.");return e},pv=()=>{const e=_u("category");ct(Eu,e)},vl=()=>{const e=qt(),t=oe();return _(()=>({...e.value.blog,...t.value.blog}))},ku=Symbol.for("tagMap"),ml=()=>{const e=he(ku);if(!e)throw new Error("useTagMap() is called without provider.");return e},fv=()=>{const e=_u("tag");ct(ku,e)},hv=e=>{const t=oe();return _(()=>{const{[_e.author]:n}=e.value;return n?Xn(n):n===!1?[]:Xn(t.value.author,!1)})},vv=e=>{const t=hl();return _(()=>sc(e.value[_e.category]).map(n=>({name:n,path:t.value.map[n].path})))},mv=e=>{const t=ml();return _(()=>ic(e.value[_e.tag]).map(n=>({name:n,path:t.value.map[n].path})))},gv=e=>_(()=>{const{[_e.date]:t}=e.value;return Ra(t)}),bv=e=>{const t=Ln(e,"info"),n=vl(),l=hv(t),r=vv(t),a=mv(t),s=gv(t),o=$c(),c=_(()=>({author:l.value,category:r.value,date:s.value,localizedDate:t.value[_e.localizedDate]||"",tag:a.value,isOriginal:t.value[_e.isOriginal]||!1,readingTime:t.value[_e.readingTime]||null,readingTimeLocale:t.value[_e.readingTime]&&o.value?Mc(t.value[_e.readingTime],o.value):null,pageview:e.path})),u=_(()=>n.value.articleInfo);return{info:c,items:u}},wu=Symbol(""),gl=()=>{const e=he(wu);if(!e)throw new Error("useArticles() is called without provider.");return e},yv=()=>{const e=cr("article");ct(wu,e)},Au=Symbol(""),Wa=()=>{const e=he(Au);if(!e)throw new Error("useStars() is called without provider.");return e},_v=()=>{const e=cr("star");ct(Au,e)},xu=Symbol(""),Ga=()=>{const e=he(xu);if(!e)throw new Error("useTimelines() is called without provider.");return e},Ev=()=>{const e=cr("timeline"),t=_(()=>{const n=[];return e.value.items.forEach(({info:l,path:r})=>{const a=Ra(l[_e.date]),s=a==null?void 0:a.getFullYear(),o=a?a.getMonth()+1:null,c=a==null?void 0:a.getDate();s&&o&&c&&((!n[0]||n[0].year!==s)&&n.unshift({year:s,items:[]}),n[0].items.push({date:`${o}/${c}`,info:l,path:r}))}),{...e.value,config:n.reverse()}});ct(xu,t)},kv=()=>{yv(),pv(),_v(),fv(),Ev()};var wv=M({name:"SocialMedia",setup(){const e=vl(),t=an(),n=_(()=>{const l=e.value.medias;return l?Sn(l).map(([r,a])=>({name:r,icon:ov[r],url:a})):[]});return()=>n.value.length?i("div",{class:"vp-social-medias"},n.value.map(({name:l,icon:r,url:a})=>i("a",{class:"vp-social-media",href:a,rel:"noopener noreferrer",target:"_blank","aria-label":l,...t.value?{}:{"data-balloon-pos":"up"},innerHTML:r}))):null}}),Ua=M({name:"BloggerInfo",setup(){const e=vl(),t=il(),n=oe(),l=gl(),r=hl(),a=ml(),s=Ga(),o=dl(),c=_(()=>{var f;return e.value.name||((f=Xn(n.value.author)[0])==null?void 0:f.name)||t.value.title}),u=_(()=>e.value.avatar||n.value.logo),d=_(()=>n.value.blogLocales),p=_(()=>e.value.intro);return()=>{const{article:f,category:h,tag:g,timeline:E}=d.value,k=[[l.value.path,l.value.items.length,f],[r.value.path,bt(r.value.map).length,h],[a.value.path,bt(a.value.map).length,g],[s.value.path,s.value.items.length,E]];return i("div",{class:"vp-blogger-info",vocab:"https://schema.org/",typeof:"Person"},[i("div",{class:"vp-blogger",...p.value?{style:{cursor:"pointer"},"aria-label":d.value.intro,"data-balloon-pos":"down",role:"link",onClick:()=>o(p.value)}:{}},[u.value?i("img",{class:["vp-blogger-avatar",{round:e.value.roundAvatar}],src:xe(u.value),property:"image",alt:"Blogger Avatar",loading:"lazy"}):null,c.value?i("div",{class:"vp-blogger-name",property:"name"},c.value):null,e.value.description?i("div",{class:"vp-blogger-description",innerHTML:e.value.description}):null,p.value?i("meta",{property:"url",content:xe(p.value)}):null]),i("div",{class:"vp-blog-counts"},k.map(([b,L,y])=>i(Ce,{class:"vp-blog-count",to:b},()=>[i("div",{class:"count"},L),i("div",y)]))),i(wv)])}}});const Ka=()=>i(ue,{name:"category"},()=>i("path",{d:"M148.41 106.992h282.176c22.263 0 40.31 18.048 40.31 40.31V429.48c0 22.263-18.047 40.31-40.31 40.31H148.41c-22.263 0-40.311-18.047-40.311-40.31V147.302c0-22.263 18.048-40.31 40.311-40.31zM147.556 553.478H429.73c22.263 0 40.311 18.048 40.311 40.31v282.176c0 22.263-18.048 40.312-40.31 40.312H147.555c-22.263 0-40.311-18.049-40.311-40.312V593.79c0-22.263 18.048-40.311 40.31-40.311zM593.927 106.992h282.176c22.263 0 40.31 18.048 40.31 40.31V429.48c0 22.263-18.047 40.31-40.31 40.31H593.927c-22.263 0-40.311-18.047-40.311-40.31V147.302c0-22.263 18.048-40.31 40.31-40.31zM730.22 920.502H623.926c-40.925 0-74.22-33.388-74.22-74.425V623.992c0-41.038 33.387-74.424 74.425-74.424h222.085c41.038 0 74.424 33.226 74.424 74.067v114.233c0 10.244-8.304 18.548-18.547 18.548s-18.548-8.304-18.548-18.548V623.635c0-20.388-16.746-36.974-37.33-36.974H624.13c-20.585 0-37.331 16.747-37.331 37.33v222.086c0 20.585 16.654 37.331 37.126 37.331H730.22c10.243 0 18.547 8.304 18.547 18.547 0 10.244-8.304 18.547-18.547 18.547z"}));Ka.displayName="CategoryIcon";const Ja=()=>i(ue,{name:"tag"},()=>i("path",{d:"M939.902 458.563L910.17 144.567c-1.507-16.272-14.465-29.13-30.737-30.737L565.438 84.098h-.402c-3.215 0-5.726 1.005-7.634 2.913l-470.39 470.39a10.004 10.004 0 000 14.164l365.423 365.424c1.909 1.908 4.42 2.913 7.132 2.913s5.223-1.005 7.132-2.913l470.39-470.39c2.01-2.11 3.014-5.023 2.813-8.036zm-240.067-72.121c-35.458 0-64.286-28.828-64.286-64.286s28.828-64.285 64.286-64.285 64.286 28.828 64.286 64.285-28.829 64.286-64.286 64.286z"}));Ja.displayName="TagIcon";const Ya=()=>i(ue,{name:"timeline"},()=>i("path",{d:"M511.997 70.568c-243.797 0-441.429 197.633-441.429 441.435 0 243.797 197.632 441.429 441.43 441.429S953.431 755.8 953.431 512.002c0-243.796-197.637-441.434-441.435-441.434zm150.158 609.093-15.605 15.61c-8.621 8.615-22.596 8.615-31.215 0L472.197 552.126c-4.95-4.944-4.34-14.888-4.34-24.677V247.14c0-12.19 9.882-22.07 22.07-22.07h22.07c12.19 0 22.07 9.882 22.07 22.07v273.218l128.088 128.088c8.62 8.62 8.62 22.595 0 31.215zm0 0"}));Ya.displayName="TimelineIcon";const Lu=()=>i(ue,{name:"slides"},()=>i("path",{d:"M896 170.667v426.666a85.333 85.333 0 0 1-85.333 85.334h-256v61.184l192.597 115.584-43.861 73.13-148.736-89.173v95.275h-85.334v-95.318l-148.736 89.216-43.861-73.13 192.597-115.627v-61.141h-256A85.333 85.333 0 0 1 128 597.333V170.667H85.333V85.333h853.334v85.334H896zm-682.667 0v426.666h597.334V170.667H213.333zM426.667 512h-85.334V341.333h85.334V512zm128 0h-85.334V256h85.334v256zm128 0h-85.334V384h85.334v128z"}));Lu.displayName="SlideIcon";const Tu=()=>i(ue,{name:"sticky"},()=>[i("path",{d:"m381.3 733.8l-161.9 118c-5.9 4.5-13.2 6.6-20.1 6.6-8.7 0-17.7-3.4-24.3-10-12.2-12.2-13.9-31.3-3.5-45.2l144.5-195.5-113.6-112.9c-11.1-11.1-13.2-28.4-5.5-42 5.5-8.7 52.1-76.4 155.5-51 1.8 0.3 3.5 0.3 5.6 0.7 4.2 0.3 9 0.7 14.2 1.7 21.9 3.5 60.8-13.9 94.5-42.7 32.3-27.5 53.1-59.4 53.1-81.6 0-5.2 0-10.8-0.3-16-0.7-20.8-2.1-52.8 21.5-76.4 28.1-28.1 72.9-30.6 103.9-5.2 0.6 0.3 1 1 1.7 1.7 16.7 16.3 187.5 187.2 189.3 188.9 14.5 14.6 22.9 34.4 22.9 55.3 0 20.8-8 40.2-22.9 54.8-23.7 23.6-56 22.6-77.1 21.6-4.9 0-10.5-0.4-15.7-0.4-20.8 0-45.8 14.6-70.5 41.3-34.3 37.5-55.5 85.8-53.8 107.7 0.7 6.9 2.1 19.1 2.4 20.8 25 101.4-42.7 147.6-50.7 152.8-13.9 8.4-31.6 6.3-42.7-4.8l-112.1-112.2z"})]);Tu.displayName="StickyIcon";const ur=()=>i(ue,{name:"article"},()=>i("path",{d:"M853.333 938.667H170.667A42.667 42.667 0 0 1 128 896V128a42.667 42.667 0 0 1 42.667-42.667h682.666A42.667 42.667 0 0 1 896 128v768a42.667 42.667 0 0 1-42.667 42.667zm-42.666-85.334V170.667H213.333v682.666h597.334zM298.667 256h170.666v170.667H298.667V256zm0 256h426.666v85.333H298.667V512zm0 170.667h426.666V768H298.667v-85.333zm256-384h170.666V384H554.667v-85.333z"}));ur.displayName="ArticleIcon";const Su=()=>i(ue,{name:"book"},()=>i("path",{d:"M256 853.333h426.667A85.333 85.333 0 0 0 768 768V256a85.333 85.333 0 0 0-85.333-85.333H469.333a42.667 42.667 0 0 1 0-85.334h213.334A170.667 170.667 0 0 1 853.333 256v512a170.667 170.667 0 0 1-170.666 170.667H213.333A42.667 42.667 0 0 1 170.667 896V128a42.667 42.667 0 0 1 42.666-42.667h128A42.667 42.667 0 0 1 384 128v304.256l61.653-41.088a42.667 42.667 0 0 1 47.36 0l61.654 41.045V256A42.667 42.667 0 0 1 640 256v256a42.667 42.667 0 0 1-66.347 35.499l-104.32-69.547-104.32 69.547A42.667 42.667 0 0 1 298.667 512V170.667H256v682.666z"}));Su.displayName="BookIcon";const Cu=()=>i(ue,{name:"link"},()=>i("path",{d:"M460.8 584.533c17.067 17.067 17.067 42.667 0 59.734-17.067 17.066-42.667 17.066-59.733 0-85.334-85.334-85.334-217.6 0-302.934L554.667 192C640 110.933 776.533 110.933 857.6 196.267c81.067 81.066 81.067 213.333 0 294.4l-68.267 64c0-34.134-4.266-68.267-17.066-102.4l21.333-21.334c51.2-46.933 55.467-128 4.267-179.2s-128-55.466-179.2-4.266c-4.267 0-4.267 4.266-4.267 4.266L465.067 401.067c-51.2 51.2-51.2 132.266-4.267 183.466m123.733-183.466C601.6 384 627.2 384 644.267 401.067c85.333 85.333 85.333 217.6 0 302.933l-153.6 149.333C405.333 934.4 268.8 934.4 187.733 849.067c-81.066-81.067-81.066-213.334 0-294.4l68.267-64c0 34.133 4.267 72.533 17.067 102.4L251.733 614.4C204.8 665.6 204.8 746.667 256 793.6c51.2 46.933 123.733 46.933 174.933 0l149.334-149.333c51.2-51.2 51.2-128 0-179.2-12.8-17.067-17.067-46.934 4.266-64z"}));Cu.displayName="LinkIcon";const Bu=()=>i(ue,{name:"project"},()=>i("path",{d:"M987.456 425.152H864V295.296a36.48 36.48 0 0 0-36.544-36.544h-360l-134.08-128.256A9.344 9.344 0 0 0 327.04 128H36.48A36.48 36.48 0 0 0 0 164.544v676.608a36.48 36.48 0 0 0 36.544 36.544h797.76a36.672 36.672 0 0 0 33.92-22.848L1021.44 475.52a36.48 36.48 0 0 0-33.92-50.304zM82.304 210.304h215.424l136.64 130.752h347.328v84.096H198.848A36.672 36.672 0 0 0 164.928 448L82.304 652.8V210.304zM808.32 795.456H108.544l118.08-292.608h699.904L808.32 795.52z"}));Bu.displayName="ProjectIcon";const Iu=()=>i(ue,{name:"friend"},()=>i("path",{d:"M860.16 213.333A268.373 268.373 0 0 0 512 186.027a267.52 267.52 0 0 0-348.16 404.48L428.8 855.893a118.613 118.613 0 0 0 166.4 0l264.96-265.386a267.52 267.52 0 0 0 0-377.174zM800 531.627l-264.96 264.96a32.427 32.427 0 0 1-46.08 0L224 530.347a183.04 183.04 0 0 1 0-256 182.187 182.187 0 0 1 256 0 42.667 42.667 0 0 0 60.587 0 182.187 182.187 0 0 1 256 0 183.04 183.04 0 0 1 3.413 256z"}));Iu.displayName="FriendIcon";const la=()=>i(ue,{name:"slide-down"},()=>i("path",{d:"M108.775 312.23c13.553 0 27.106 3.734 39.153 11.806l375.205 250.338 363.641-252.808c32.587-21.624 76.499-12.83 98.123 19.757 21.685 32.467 12.95 76.56-19.576 98.184l-402.854 278.89c-23.733 15.901-54.694 15.962-78.547.12L69.501 442.097c-32.647-21.685-41.441-65.777-19.817-98.304 13.734-20.54 36.201-31.563 59.09-31.563Z"}));la.displayName="SlideDownIcon";const Ru=()=>i("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"empty-icon",viewBox:"0 0 1024 1024",innerHTML:''});Ru.displayName="EmptyIcon";const Ou=()=>i(ue,{name:"lock"},()=>i("path",{d:"M787.168 952.268H236.832c-30.395 0-55.033-24.638-55.033-55.033V429.45c0-30.395 24.638-55.034 55.033-55.034h82.55V264.35c0-106.38 86.238-192.618 192.618-192.618S704.618 157.97 704.618 264.35v110.066h82.55c30.395 0 55.033 24.639 55.033 55.034v467.785c0 30.395-24.639 55.033-55.033 55.033zM484.483 672.046v115.122h55.034V672.046c31.99-11.373 55.033-41.605 55.033-77.496 0-45.592-36.958-82.55-82.55-82.55s-82.55 36.958-82.55 82.55c0 35.89 23.042 66.123 55.033 77.496zM622.067 264.35c0-60.788-49.28-110.067-110.067-110.067s-110.067 49.28-110.067 110.067v110.066h220.135V264.35z"}));Ou.displayName="LockIcon";var Av=M({name:"ArticleItem",props:{info:{type:Object,required:!0},path:{type:String,required:!0}},slots:Object,setup(e,{slots:t}){const n=Ln(e,"info"),{info:l,items:r}=bv(e);return()=>{var f,h,g;const{[_e.title]:a,[_e.type]:s,[_e.isEncrypted]:o=!1,[_e.cover]:c,[_e.excerpt]:u,[_e.sticky]:d}=n.value,p=l.value;return i("div",{class:"vp-article-wrapper"},i("article",{class:"vp-article-item",vocab:"https://schema.org/",typeof:"Article"},[((f=t.cover)==null?void 0:f.call(t,{cover:c}))||(c?[i("img",{class:"vp-article-cover",src:xe(c),loading:"lazy"}),i("meta",{property:"image",content:xe(c)})]:[]),d?i(Tu):null,i(Ce,{to:e.path},()=>{var E;return((E=t.title)==null?void 0:E.call(t,{title:a,isEncrypted:o,type:s}))||i("header",{class:"vp-article-title"},[o?i(Ou):null,s===qc.slide?i(Lu):null,i("span",{property:"headline"},a)])}),((h=t.excerpt)==null?void 0:h.call(t,{excerpt:u}))||(u?i("div",{class:"vp-article-excerpt",innerHTML:u}):null),i("hr",{class:"vp-article-hr"}),((g=t.info)==null?void 0:g.call(t,{info:p}))||i(fu,{info:p,...r.value?{items:r.value}:{}})]))}}}),xv=M({name:"Pagination",props:{total:{type:Number,default:10},perPage:{type:Number,default:10},current:{type:Number,default:1}},emits:["updateCurrentPage"],setup(e,{emit:t}){let n;const l=oe(),r=J(""),a=_(()=>l.value.paginationLocales),s=_(()=>Math.ceil(e.total/e.perPage)),o=_(()=>!!s.value&&s.value!==1),c=_(()=>s.value<7?!1:e.current>4),u=_(()=>s.value<7?!1:e.current{const{current:h}=e;let g=1,E=s.value;const k=[];s.value>=7&&(h<=4&&h4&&h>=s.value-3?(E=s.value,g=s.value-4):s.value>7&&(g=h-2,E=h+2));for(let b=g;b<=E;b++)k.push(b);return k}),p=h=>t("updateCurrentPage",h),f=h=>{const g=parseInt(h);g<=s.value&&g>0?p(g):n.pop(`${a.value.errorText.replace(/\$page/g,s.value.toString())}`)};return Ee(()=>{n=new Xf}),()=>i("div",{class:"vp-pagination"},o.value?i("nav",{class:"vp-pagination-list"},[i("div",{class:"vp-pagination-number "},[e.current>1?i("div",{class:"prev",role:"navigation",unselectable:"on",onClick:()=>p(e.current-1)},a.value.prev):null,c.value?[i("div",{role:"navigation",onClick:()=>p(1)},1),i("div",{class:"ellipsis"},"...")]:null,d.value.map(h=>i("div",{key:h,class:{active:e.current===h},role:"navigation",onClick:()=>p(h)},h)),u.value?[i("div",{class:"ellipsis"},"..."),i("div",{role:"navigation",onClick:()=>p(s.value)},s.value)]:null,e.currentp(e.current+1)},a.value.next):null]),i("div",{class:"vp-pagination-nav"},[i("label",{for:"navigation-text"},`${a.value.navigate}: `),i("input",{id:"navigation-text",value:r.value,onInput:({target:h})=>{r.value=h.value},onKeydown:h=>{h.key==="Enter"&&(h.preventDefault(),f(r.value))}}),i("button",{class:"vp-pagination-button",role:"navigation",title:a.value.action,onClick:()=>f(r.value)},a.value.action)])]):[])}}),Za=M({name:"ArticleList",props:{items:{type:Array,default:()=>[]}},setup(e){const t=rt(),n=Me(),l=vl(),r=J(1),a=_(()=>l.value.articlePerPage||10),s=_(()=>e.items.slice((r.value-1)*a.value,r.value*a.value)),o=async c=>{r.value=c;const u={...t.query};!(u.page===c.toString()||c===1&&!u.page)&&(c===1?delete u.page:u.page=c.toString(),await n.push({path:t.path,query:u}))};return Ee(()=>{const{page:c}=t.query;console.log("mounted"),o(c?Number(c):1),me(r,()=>{const u=document.querySelector("#article-list").getBoundingClientRect().top+window.scrollY;setTimeout(()=>{window.scrollTo(0,u)},100)})}),()=>i("div",{id:"article-list",class:"vp-article-list",role:"feed"},s.value.length?[...s.value.map(({info:c,path:u},d)=>i(fe,{appear:!0,delay:d*.04},()=>i(Av,{key:u,info:c,path:u}))),i(xv,{current:r.value,perPage:a.value,total:e.items.length,onUpdateCurrentPage:o})]:i(Ru))}}),Pu=M({name:"CategoryList",setup(){const e=ie(),t=hl();return()=>i("ul",{class:"vp-category-list"},Sn(t.value.map).sort(([,n],[,l])=>l.items.length-n.items.length).map(([n,{path:l,items:r}])=>i("li",{class:["vp-category",`vp-category${or(n,9)}`,{active:l===e.value.path}]},i(Ce,{to:l},()=>[n,i("span",{class:"count"},r.length)]))))}}),Du=M({name:"TagList",setup(){const e=be(),t=ml(),n=l=>{var r;return l===((r=e.value.blog)==null?void 0:r.name)};return()=>i("ul",{class:"tag-list-wrapper"},Sn(t.value.map).sort(([,l],[,r])=>r.items.length-l.items.length).map(([l,{path:r,items:a}])=>i("li",{class:["tag",`tag${or(l,9)}`,{active:n(l)}]},i(Ce,{to:r},()=>[l,i("span",{class:"tag-num"},a.length)]))))}}),Lv=M({name:"TimelineList",setup(){const e=oe(),t=Ga(),n=dl(),l=_(()=>e.value.blogLocales.timeline);return()=>i("div",{class:"timeline-list-wrapper"},[i("div",{class:"timeline-list-title",onClick:()=>n(t.value.path)},[i(Ya),i("span",{class:"num"},t.value.items.length),l.value]),i("hr"),i("div",{class:"timeline-content"},i("ul",{class:"timeline-list"},t.value.config.map(({year:r,items:a},s)=>i(fe,{appear:!0,delay:.08*(s+1)},()=>i("li",[i("h3",{class:"timeline-year"},r),i("ul",{class:"timeline-year-wrapper"},a.map(({date:o,info:c,path:u})=>i("li",{class:"timeline-item"},[i("span",{class:"timeline-date"},o),i(Ce,{class:"timeline-title",to:u},()=>c[_e.title])])))])))))])}});const Tv={article:ur,category:Ka,tag:Ja,timeline:Ya};var Mu=M({name:"InfoList",setup(){const e=oe(),t=gl(),n=hl(),l=_(()=>bt(n.value.map).length),r=Wa(),a=ml(),s=_(()=>bt(a.value.map).length),o=dl(),c=J("article"),u=_(()=>e.value.blogLocales);return()=>i("div",{class:"vp-blog-infos"},[i("div",{class:"vp-blog-type-switcher"},Sn(Tv).map(([d,p])=>i("button",{type:"button",class:"vp-blog-type-button",onClick:()=>{c.value=d}},i("div",{class:["icon-wrapper",{active:c.value===d}],"aria-label":u.value[d],"data-balloon-pos":"up"},i(p))))),i(fe,()=>c.value==="article"?i("div",{class:"vp-star-article-wrapper"},[i("div",{class:"title",onClick:()=>o(t.value.path)},[i(ur),i("span",{class:"num"},t.value.items.length),u.value.article]),i("hr"),r.value.items.length?i("ul",{class:"vp-star-articles"},r.value.items.map(({info:d,path:p},f)=>i(fe,{appear:!0,delay:.08*(f+1)},()=>i("li",{class:"vp-star-article"},i(Ce,{to:p},()=>d[_e.title]))))):i("div",{class:"vp-star-article-empty"},u.value.empty.replace("$text",u.value.star))]):c.value==="category"?i("div",{class:"vp-category-wrapper"},[l.value?[i("div",{class:"title",onClick:()=>o(n.value.path)},[i(Ka),i("span",{class:"num"},l.value),u.value.category]),i("hr"),i(fe,{delay:.04},()=>i(Pu))]:i("div",{class:"vp-category-empty"},u.value.empty.replace("$text",u.value.category))]):c.value==="tag"?i("div",{class:"vp-tag-wrapper"},[s.value?[i("div",{class:"title",onClick:()=>o(a.value.path)},[i(Ja),i("span",{class:"num"},s.value),u.value.tag]),i("hr"),i(fe,{delay:.04},()=>i(Du))]:i("div",{class:"vp-tag-empty"},u.value.empty.replace("$text",u.value.tag))]):i(fe,()=>i(Lv)))])}}),dr=M({name:"BlogWrapper",slots:Object,setup(e,{slots:t}){const{isMobile:n}=pl();return()=>[i(qa),i(Ha,{noSidebar:!0,noToc:!0},{default:()=>t.default(),navScreenBottom:()=>i(Ua),...n.value?{sidebar:()=>i(Mu)}:{}})]}});const $u=()=>i("aside",{class:"vp-blog-info-wrapper"},[i(fe,()=>i(Ua)),i(fe,{delay:.04},()=>i(Mu))]);$u.displayName="InfoPanel";var pr=$u,Sv=M({name:"BlogPage",setup(){const e=ie(),t=be(),n=hl(),l=ml();return()=>{const{key:r="",name:a=""}=t.value.blog||{},s=a?r==="category"?n.value.map[a].items:r==="tag"?l.value.map[a].items:[]:[];return i(dr,()=>i("div",{class:"vp-page vp-blog"},i("div",{class:"blog-page-wrapper"},[i("main",{id:"main-content",class:"vp-blog-main"},[i(fe,()=>r==="category"?i(Pu):r==="tag"?i(Du):null),a?i(fe,{appear:!0,delay:.24},()=>i(Za,{key:e.value.path,items:s})):null]),i(fe,{delay:.16},()=>i(pr,{key:"blog"}))])))}}});const Cv="//theme-hope-assets.vuejs.press/hero/default.jpg";var Bv=M({name:"BlogHero",slots:Object,setup(e,{slots:t}){const n=be(),l=il(),r=lt(),a=_(()=>n.value.heroFullScreen??!1),s=_(()=>{const{heroText:c,heroImage:u,heroImageDark:d,heroAlt:p,heroImageStyle:f,tagline:h}=n.value;return{text:c??l.value.title??"Hello",image:u?xe(u):null,imageDark:d?xe(d):null,heroStyle:f,alt:p||c||"",tagline:h??"",isFullScreen:a.value}}),o=_(()=>{const{bgImage:c,bgImageDark:u,bgImageStyle:d}=n.value;return{image:se(c)?xe(c):c===!1?null:Cv,imageDark:se(u)?xe(u):null,bgStyle:d,isFullScreen:a.value}});return()=>{var c,u;return n.value.hero===!1?null:i("div",{ref:r,class:["vp-blog-hero",{fullscreen:a.value,"no-bg":!o.value.image}]},[((c=t.heroBg)==null?void 0:c.call(t,o.value))||[o.value.image?i("div",{class:["vp-blog-mask",{light:o.value.imageDark}],style:[{background:`url(${o.value.image}) center/cover no-repeat`},o.value.bgStyle]}):null,o.value.imageDark?i("div",{class:"vp-blog-mask dark",style:[{background:`url(${o.value.imageDark}) center/cover no-repeat`},o.value.bgStyle]}):null],((u=t.heroInfo)==null?void 0:u.call(t,s.value))||[i(fe,{appear:!0,type:"group",delay:.04},()=>[s.value.image?i("img",{key:"light",class:["vp-blog-hero-image",{light:s.value.imageDark}],style:s.value.heroStyle,src:s.value.image,alt:s.value.alt}):null,s.value.imageDark?i("img",{key:"dark",class:"vp-blog-hero-image dark",style:s.value.heroStyle,src:s.value.imageDark,alt:s.value.alt}):null]),i(fe,{appear:!0,delay:.08},()=>s.value.text?i("h1",{class:"vp-blog-hero-title"},s.value.text):null),i(fe,{appear:!0,delay:.12},()=>s.value.tagline?i("p",{class:"vp-blog-hero-description",innerHTML:s.value.tagline}):null)],s.value.isFullScreen?i("button",{type:"button",class:"slide-down-button",onClick:()=>{window.scrollTo({top:r.value.clientHeight,behavior:"smooth"})}},[i(la),i(la)]):null])}}});const Iv=["link","article","book","project","friend"];var Rv=M({name:"ProjectPanel",components:{ArticleIcon:ur,BookIcon:Su,FriendIcon:Iu,LinkIcon:Cu,ProjectIcon:Bu},props:{items:{type:Array,required:!0}},setup(e){const t=an(),n=dl(),l=(r="",a="icon")=>Iv.includes(r)?i(Ke(`${r}-icon`)):rn(r)?i("img",{class:"vp-project-image",src:r,alt:a}):Cn(r)?i("img",{class:"vp-project-image",src:xe(r),alt:a}):i(Ne,{icon:r});return()=>i("div",{class:"vp-project-panel"},e.items.map(({icon:r,link:a,name:s,desc:o},c)=>i("div",{class:["vp-project-card",{[`project${c%9}`]:!t.value}],onClick:()=>n(a)},[l(r,s),i("div",{class:"vp-project-name"},s),i("div",{class:"vp-project-desc"},o)])))}}),Ov=M({name:"BlogHome",setup(){const e=gl(),t=be(),n=_(()=>t.value.projects??[]);return()=>i("div",{class:"vp-page vp-blog"},[i(Bv),i("div",{class:"blog-page-wrapper"},[i("main",{id:"main-content",class:"vp-blog-main"},[n.value.length?i(fe,{appear:!0,delay:.16},()=>i(Rv,{items:n.value})):null,i(fe,{appear:!0,delay:.24},()=>i(Za,{items:e.value.items}))]),i(fe,{appear:!0,delay:.16},()=>i(pr,{key:"blog"}))]),i(fe,{appear:!0,delay:.28},()=>i(za))])}});const Fu=()=>i(dr,()=>i(Ov));Fu.displayName="BlogHomeLayout";var Pv=Fu,Dv=M({name:"ArticleType",setup(){const e=ie(),t=yt(),n=oe(),l=gl(),r=Wa(),a=_(()=>{const s=n.value.blogLocales;return[{text:s.all,path:l.value.path},{text:s.star,path:r.value.path},...dv.map(({key:o,path:c})=>({text:s[o],path:c.replace(/^\//,t.value)}))]});return()=>i("ul",{class:"vp-article-type-wrapper"},a.value.map(s=>i("li",{class:["vp-article-type",{active:s.path===e.value.path}]},i(Ce,{to:s.path},()=>s.text))))}}),Mv=M({name:"BlogPage",setup(){const e=cr(),t=be(),n=ie(),l=gl(),r=Wa(),a=_(()=>{const{key:s="",type:o}=t.value.blog||{};return s==="star"?r.value.items:o==="type"&&s?e.value.items:l.value.items});return()=>i(dr,()=>i("div",{class:"vp-page vp-blog"},i("div",{class:"blog-page-wrapper"},[i("main",{id:"main-content",class:"vp-blog-main"},[i(fe,()=>i(Dv)),i(fe,{appear:!0,delay:.24},()=>i(Za,{key:n.value.path,items:a.value}))]),i(fe,{delay:.16},()=>i(pr,{key:"blog"}))])))}}),$v=M({name:"TimelineItems",setup(){const e=vl(),t=oe(),n=Ga(),l=_(()=>e.value.timeline||t.value.blogLocales.timelineTitle),r=_(()=>n.value.config.map(({year:a})=>({title:a.toString(),level:2,slug:a.toString(),children:[]})));return()=>i("div",{class:"timeline-wrapper"},i("ul",{class:"timeline-content"},[i(fe,()=>i("li",{class:"motto"},l.value)),i(hu,{items:r.value}),n.value.config.map(({year:a,items:s},o)=>i(fe,{appear:!0,delay:.08*(o+1),type:"group"},()=>[i("h3",{key:"title",id:a,class:"timeline-year-title"},i("span",a)),i("li",{key:"content",class:"timeline-year-list"},[i("ul",{class:"timeline-year-wrapper"},s.map(({date:c,info:u,path:d})=>i("li",{class:"timeline-item"},[i("span",{class:"timeline-date"},c),i(Ce,{class:"timeline-title",to:d},()=>u[_e.title])])))])]))]))}});const Vu=()=>i(dr,()=>i("div",{class:"vp-page vp-blog"},i("div",{class:"blog-page-wrapper"},[i("main",{id:"main-content",class:"vp-blog-main"},[i(fe,{appear:!0,delay:.24},()=>i($v))]),i(fe,{delay:.16},()=>i(pr,{key:"blog"}))])));Vu.displayName="Timeline";var Fv=Vu;zh(e=>{const t=e.t,n=e.I!==!1,l=e.i;return n?{title:t,content:l?()=>[i(Ne,{icon:l}),t]:null,order:e.O,index:e.I}:null});const Vv=Je({enhance:({app:e,router:t})=>{const{scrollBehavior:n}=t.options;t.options.scrollBehavior=async(...l)=>(await vu().wait(),n(...l)),i2(e),e.component("HopeIcon",Ne),e.component("VPLink",Ce),e.component("BloggerInfo",Ua)},setup:()=>{o2(),p2(),kv()},layouts:{Layout:av,NotFound:iv,BlogCategory:Sv,BlogHome:Pv,BlogType:Mv,Timeline:Fv}});var Nv={provider:"Giscus",comment:!0,repo:"Zephery/MyWebsite",repoId:"MDEwOlJlcG9zaXRvcnkyMDM2MDIyMDQ=",category:"General",categoryId:"DIC_kwDODCK5HM4Ccp32"};const jv=Nv;let Hv=jv;const Nu=Symbol(""),ju=()=>he(Nu),zv=ju,qv=e=>{e.provide(Nu,Hv)},wi=["ar","ca","de","en","eo","es","fa","fr","he","id","it","ja","ko","nl","pl","pt","ro","ru","th","tr","uk","vi","zh-CN","zh-TW"];var Wv=M({name:"GiscusComment",props:{identifier:{type:String,required:!0},darkmode:Boolean},setup(e){const t=zv(),n=!!(t.repo&&t.repoId&&t.category&&t.categoryId),{repo:l,repoId:r,category:a,categoryId:s}=t,o=J(!1),c=_(()=>{const d=Sa().value;if(wi.includes(d))return d;const p=d.split("-")[0];return wi.includes(p)?p:"en"}),u=_(()=>({repo:l,repoId:r,category:a,categoryId:s,lang:c.value,theme:e.darkmode?t.darkTheme||"dark":t.lightTheme||"light",mapping:t.mapping||"pathname",term:e.identifier,inputPosition:t.inputPosition||"top",reactionsEnabled:t.reactionsEnabled===!1?"0":"1",strict:t.strict===!1?"0":"1",loading:t.lazyLoading===!1?"eager":"lazy",emitMetadata:"0"}));return Ee(async()=>{await A(()=>import("./giscus-NkhROb6B.js"),__vite__mapDeps([])),o.value=!0}),()=>n?i("div",{id:"comment",class:["giscus-wrapper",{"input-top":t.inputPosition!=="bottom"}]},o.value?i("giscus-widget",u.value):i(tc)):null}}),Gv=M({name:"CommentService",props:{darkmode:Boolean},setup(e){const t=ju(),n=ie(),l=be(),r=t.comment!==!1,a=_(()=>l.value.comment||r&&l.value.comment!==!1);return()=>i(Wv,{identifier:l.value.commentID||n.value.path,darkmode:e.darkmode,style:{display:a.value?"block":"none"}})}}),Uv=Je({enhance:({app:e})=>{qv(e),e.component("CommentService",Gv)}});const Pl=[Np,Dh,Hh,Kh,Qh,n0,i0,v0,b0,k0,O0,Y0,Vv,Uv],Kv=[["v-8daa1a0e","/",{d:1706066758e3,e:` +`,r:{minutes:1.03,words:309},y:"a",t:""},["/README.md"]],["v-79fdd481","/home.html",{d:1706084611e3,e:``,r:{minutes:1.02,words:305},y:"a",t:""},[":md"]],["v-cfe8b6c8","/cloudnative/",{d:1706066758e3,y:"a",t:""},["/cloudnative/README.md"]],["v-02bc92be","/bigdata/",{d:1706182936e3,y:"a",t:""},["/bigdata/README.md"]],["v-2e25198a","/database/",{d:1706182936e3,e:` +`,r:{minutes:.05,words:15},y:"a",t:""},["/database/README.md"]],["v-71fde78e","/devops/",{d:1706066758e3,e:`

三、DevOps

+`,r:{minutes:.08,words:24},y:"a",t:"三、DevOps"},["/devops/README.md"]],["v-580db9be","/devops/devops-ping-tai.html",{d:1706066758e3,e:`

3.1 DevOps平台.md

+

DevOps定义(来自维基百科): DevOps(Development和Operations的组合词)是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。

+

公司技术部目前几百人左右吧,但是整个技术栈还是比较落后的,尤其是DevOps、容器这一块,需要将全线打通,当时进来也主要是负责DevOps这一块的工作,应该说也是没怎么做好,其中也走了不少弯路,下面主要是自己踩过的坑吧。

`,r:{minutes:11.93,words:3580},y:"a",t:"3.1 DevOps平台.md"},[":md"]],["v-06d5cd4c","/devops/gitlab-ci.html",{d:1706066758e3,e:`

Git

+`,r:{minutes:0,words:1},y:"a",t:"Git"},[":md"]],["v-132efcd1","/devops/jenkins-x.html",{d:1706066758e3,e:`

jenkins-x

+`,r:{minutes:.01,words:2},y:"a",t:"jenkins-x"},[":md"]],["v-1a2ca7a7","/devops/tekton.html",{d:1706066758e3,e:`

tekton

+`,r:{minutes:0,words:1},y:"a",t:"tekton"},[":md"]],["v-50cb12f2","/donate/",{d:1706182936e3,e:`

微信支付

+
微信支付
+`,r:{minutes:.03,words:9},y:"a",t:"微信支付"},["/donate/README.md"]],["v-375ccf42","/interview/jvm.html",{d:1706066758e3,e:`
+
+
+`,r:{minutes:.02,words:6},y:"a",t:""},[":md"]],["v-d642798c","/interview/kafka.html",{d:1706066758e3,e:`

1、请说明什么是Apache Kafka?
+Apache Kafka是由Apache开发的一种发布订阅消息系统,它是一个分布式的、分区的和可复制的提交日志服务。

+

2、说说Kafka的使用场景?
+①异步处理
+②应用解耦
+③流量削峰
+④日志处理
+⑤消息通讯等。

+

3、使用Kafka有什么优点和缺点?
+优点:
+①支持跨数据中心的消息复制;
+②单机吞吐量:十万级,最大的优点,就是吞吐量高;
+③topic数量都吞吐量的影响:topic从几十个到几百个的时候,吞吐量会大幅度下降。所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源;
+④时效性:ms级;
+⑤可用性:非常高,kafka是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用;
+⑥消息可靠性:经过参数优化配置,消息可以做到0丢失;
+⑦功能支持:功能较为简单,主要支持简单的MQ功能,在大数据领域的实时计算以及日志采集被大规模使用。

`,r:{minutes:17,words:5099},y:"a",t:""},[":md"]],["v-473223ec","/interview/kubernetes.html",{d:1706066758e3,y:"a",t:""},[":md"]],["v-0b13f184","/interview/mysql.html",{d:1706066758e3,y:"a",t:""},[":md"]],["v-091223ce","/interview/tiktok2023.html",{d:1706066758e3,e:`

tt一面:
+1.全程项目
+2.lc3,最长无重复子串,滑动窗口解决

+

tt二面:
+全程基础,一直追问
+1.java内存模型介绍一下
+2.volatile原理
+3.内存屏障,使用场景?(我提了在gc中有使用)
+4.gc中具体是怎么使用内存屏障的,详细介绍
+5.cms和g1介绍一下,g1能取代cms吗?g1和cms各自的使用场景是什么
+6.线程内存分配方式,tlab相关
+7.happens-before介绍一下
+8.总线风暴是什么,怎么解决
+9.网络相关,time_wait,close_wait产生原因,带来的影响,怎么解决
+10.算法题,给你一个数字n,求用这个n的各位上的数字组合出最大的小于n的数字m,注意边界case,如2222
+11.场景题,设计一个微信朋友圈,功能包含feed流拉取,评论,转发,点赞等操作

`,r:{minutes:1.15,words:344},y:"a",t:""},[":md"]],["v-0a27b598","/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html",{d:1706066758e3,e:`

JVM调优参数

+

一、堆大小设置

+

JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可用虚拟内存限制;系统的可用物理内存限制。32位系统 下,一般限制在1.5G~2G;64为操作系统对内存无限制。我在Windows Server 2003 系统,3.5G物理内存,JDK5.0下测试,最大可设置为1478m。

+

典型设置:

+
java -Xmx3550m -Xms3550m -Xmn2g -Xss128k
+
`,r:{minutes:9.13,words:2739},y:"a",t:"JVM调优参数"},["/java/JVM调优参数.html","/java/JVM调优参数.md",":md"]],["v-478d0de6","/java/lucene%E6%90%9C%E7%B4%A2%E5%8E%9F%E7%90%86.html",{d:1706066758e3,e:`

lucene搜索原理

+`,r:{minutes:.02,words:5},y:"a",t:"lucene搜索原理"},["/java/lucene搜索原理.html","/java/lucene搜索原理.md",":md"]],["v-60eda44c","/java/serverlog.html",{d:1706066758e3,e:`

被挖矿攻击

+

服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看:
+
+stratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG

`,r:{minutes:.57,words:172},y:"a",t:"被挖矿攻击"},[":md"]],["v-399e07b6","/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html",{d:1706066758e3,e:`

一次jvm调优过程

+

前端时间把公司的一个分布式定时调度的系统弄上了容器云,部署在kubernetes,在容器运行的动不动就出现问题,特别容易jvm溢出,导致程序不可用,终端无法进入,日志一直在刷错误,kubernetes也没有将该容器自动重启。业务方基本每天都在反馈task不稳定,后续就协助接手看了下,先主要讲下该程序的架构吧。
+该程序task主要分为三个模块:
+console进行一些cron的配置(表达式、任务名称、任务组等);
+schedule主要从数据库中读取配置然后装载到quartz再然后进行命令下发;
+client接收任务执行,然后向schedule返回运行的信息(成功、失败原因等)。
+整体架构跟github上开源的xxl-job类似,也可以参考一下。

`,r:{minutes:6.23,words:1870},y:"a",t:"一次jvm调优过程"},["/java/一次jvm调优过程.html","/java/一次jvm调优过程.md",":md"]],["v-660266c1","/java/%E5%86%85%E5%AD%98%E5%B1%8F%E9%9A%9C.html",{d:1706066758e3,e:`

内存屏障

+

四个内存屏障指令:LoadLoad,StoreStore,LoadStore,StoreLoad

+

在每个volatile写操作前插入StoreStore屏障,这样就能让其他线程修改A变量后,把修改的值对当前线程可见,在写操作后插入StoreLoad屏障,这样就能让其他线程获取A变量的时候,能够获取到已经被当前线程修改的值

+

在每个volatile读操作前插入LoadLoad屏障,这样就能让当前线程获取A变量的时候,保证其他线程也都能获取到相同的值,这样所有的线程读取的数据就一样了,在读操作后插入LoadStore屏障;这样就能让当前线程在其他线程修改A变量的值之前,获取到主内存里面A变量的的值。

`,r:{minutes:.69,words:208},y:"a",t:"内存屏障"},["/java/内存屏障.html","/java/内存屏障.md",":md"]],["v-90f2343c","/java/%E5%9C%A8%20Spring%206%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%99%9A%E6%8B%9F%E7%BA%BF%E7%A8%8B.html",{d:1706186538e3,e:`

在 Spring 6 中使用虚拟线程

+

一、简介

+

在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。

+

虚拟线程是Java 19 的预览功能,这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。Spring 6 版本最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。

`,r:{minutes:4.81,words:1442},y:"a",t:"在 Spring 6 中使用虚拟线程"},["/java/在 Spring 6 中使用虚拟线程.html","/java/在 Spring 6 中使用虚拟线程.md",":md"]],["v-0b5d4df0","/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html",{d:1706066758e3,e:`

基于kubernetes的分布式限流

+

做为一个数据上报系统,随着接入量越来越大,由于 API 接口无法控制调用方的行为,因此当遇到瞬时请求量激增时,会导致接口占用过多服务器资源,使得其他请求响应速度降低或是超时,更有甚者可能导致服务器宕机。

+

一、概念

+

限流(Ratelimiting)指对应用服务的请求进行限制,例如某一接口的请求限制为 100 个每秒,对超过限制的请求则进行快速失败或丢弃。

+

1.1 使用场景

+

限流可以应对:

+
    +
  • 热点业务带来的突发请求;
  • +
  • 调用方 bug 导致的突发请求;
  • +
  • 恶意攻击请求。
  • +
`,r:{minutes:7.15,words:2145},y:"a",t:"基于kubernetes的分布式限流"},["/java/基于kubernetes的分布式限流.html","/java/基于kubernetes的分布式限流.md",":md"]],["v-f48afbfc","/kafka/",{d:1706066758e3,y:"a",t:""},["/kafka/README.md"]],["v-21e54510","/kubernetes/",{d:1706066758e3,y:"a",t:""},["/kubernetes/README.md"]],["v-57ae83ac","/kubernetes/spark%20on%20k8s%20operator.html",{d:1706066758e3,e:`

spark on k8s operator

+

Spark operator是一个管理Kubernetes上的Apache Spark应用程序生命周期的operator,旨在像在Kubernetes上运行其他工作负载一样简单的指定和运行spark应用程序。

+

使用Spark Operator管理Spark应用,能更好的利用Kubernetes原生能力控制和管理Spark应用的生命周期,包括应用状态监控、日志获取、应用运行控制等,弥补Spark on Kubernetes方案在集成Kubernetes上与其他类型的负载之间存在的差距。

+

Spark Operator包括如下几个组件:

`,r:{minutes:3.5,words:1050},y:"a",t:"spark on k8s operator"},["/kubernetes/spark on k8s operator.html","/kubernetes/spark on k8s operator.md",":md"]],["v-22e4234a","/life/2017.html",{d:1706066758e3,e:`

2016年6月,大三,考完最后一科,默默的看着大四那群人一个一个的走了,想着想着,明年毕业的时候,自己将会失去你所拥有的一切,大学那群认识的人,可能这辈子都不会见到了——致远离家乡出省读书的娃。然而,我并没有想到,自己失去的,不仅仅是那群人,几乎是一切。。。。
+17年1月,因为受不了北京雾霾(其实是次因),从实习的公司跑路了,很不舍,只是,感觉自己还有很多事要做,很多梦想要去实现,毕竟,看着身边的人,去了美团,拿着15k的月薪,有点不平衡,感觉他也不是很厉害吧,我努力努力10k应该没问题吧?

+
`,r:{minutes:11.22,words:3365},y:"a",t:""},[":md"]],["v-1f7a720c","/life/2018.html",{d:1706066758e3,e:`

年底老姐结婚,跑回家去了,忙着一直没写,本来想回深圳的时候空余的时候写写,没想到一直加班,嗯,9点半下班那种,偶尔也趁着间隙的时间,一段一段的凑着吧。

+

想着17年12月31号写的那篇文章https://www.cnblogs.com/w1570631036/p/8158284.html,感叹18年还算恢复了点。

+

心惊胆战的裸辞经历

+

其实校招过去的那家公司,真的不是很喜欢,996、技术差、产品差,实在受不了,春节前提出了离职,老大也挽留了下,以“来了个阿里的带我们重构,能学不了东西”来挽留,虽然我对技术比较痴迷,但离职去深圳的决心还是没有动摇,嗯,就这么开始了自己的裸辞过程。3月8号拿到离职,回公司的时候跟跟同事吹吹水,吃个饭,某同事还喊:“周末来公司玩玩么,我给你开门”,哈哈哈,泼出去的水,回不去了,偶尔有点伤感。
+去深圳面试,第一家随手记,之前超级想去这家公司的,金融这一块,有钱,只可惜,没过,一面面试官一直夸我,我觉得稳了,二面没转过来,就这么挂了,有点不甘心吧,在这,感谢那个内推我的人吧,面经在这,之后就是大大小小的面试,联想、恒大、期待金融什么的,都没拿到offer,裸辞真的慌得一比,一天没工作,感觉一年没有工作没人要的样子。。。。没面试就跑去广州图书馆,复习,反思,一天一天的过着,回家就去楼下吃烧烤,打游戏,2点3点才睡觉,boss直聘、拉勾网见一个问一个,迷迷糊糊慌慌张张,那段期间真的想有点把所有书卖掉回家啃老的想法,好在最后联系了一家公司,电商、大小周,知乎上全是差评,不过评价的都不是技术的,更重要的是,岗位是中间件的,嗯,去吧。

`,r:{minutes:4.35,words:1305},y:"a",t:""},[":md"]],["v-1c10c0ce","/life/2019.html",{d:1706066758e3,e:`

2019,本命年,1字头开头的年份,就这么过去了,迎来了2开头的十年,12月过的不是很好,每隔几天就吵架,都没怎么想起写自己的年终总结了,对这个跨年也不是很重视,貌似有点浑浑噩噩的样子。今天1号,就继续来公司学习学习,就写写文章吧。
+19年一月,没发生什么事,对老板也算是失望,打算过完春节就出去外面试试,完全的架构错误啊,怎么守得了,然后开了个年会,没什么好看的,唯一的例外就是看见漂漂亮亮的她,可惜不敢搭话,就这么的呗。2月以奇奇怪怪的方式走到了一起,开心,又有点伤心,然后就开始了这个欢喜而又悲剧的本命年。

+

工作

+

从18年底开始吧,大概就知道领导对容器云这么快的完全架构设计错误,就是一个完完全全错误的产品,其他人也觉得有点很有问题,但老板就是固执不听,结果一个跑路,一个被压得懒得反抗,然后我一个人跟老板和项目经理怼了前前后后半年,真是惨啊,还要被骂,各种拉到小黑屋里批斗,一直在对他们强调:没有这么做的!!!然后被以年轻人,不懂事,不要抱怨,长大了以后就领会了怼回来,当时气得真是无语。。。。。自己调研的阿里云、腾讯云、青云,还有其他小公司的容器,发现真的只有我们这么设计,完全错误的方向,,,,直到老板走了之后,才开始决定重构,走上正轨。

`,r:{minutes:4.43,words:1328},y:"a",t:""},[":md"]],["v-14e6315a","/life/",{d:1706066758e3,y:"a",t:""},["/life/README.md"]],["v-258f309e","/open-source-project/",{d:1706092222e3,e:`

jfaowejfoewj

+`,r:{minutes:0,words:1},y:"a",t:""},["/open-source-project/README.md"]],["v-510415f9","/others/chatgpt.html",{d:1706186538e3,e:`

微信公众号-chatgpt智能客服搭建

+

想体验的可以去微信上搜索【旅行的树】公众号。

+

一、ChatGPT注册

+

1.1 短信手机号申请

+

openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。

+

国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。

+

国外手机号,没有的话也可以去https://sms-activate.org,费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。

`,r:{minutes:9.66,words:2899},y:"a",t:"微信公众号-chatgpt智能客服搭建"},[":md"]],["v-3c114a75","/others/tesla.html",{d:1706186538e3,e:`

Tesla api

+

一、特斯拉应用申请

+

1.1 创建 Tesla 账户

+

如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。

+

正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator.

+ + +

注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。

+

1.2 提交访问请求

+

点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。

`,r:{minutes:4.46,words:1339},y:"a",t:"Tesla api"},[":md"]],["v-37ac02fe","/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html",{d:1706182936e3,e:`

1.历史与架构

+

各位大佬瞄一眼我的个人网站呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址https://github.com/Zephery/newblog
+大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。

`,r:{minutes:6.78,words:2033},y:"a",t:"1.历史与架构"},["/personalWebsite/1.历史与架构.html","/personalWebsite/1.历史与架构.md",":md"]],["v-523e9724","/personalWebsite/10.%E7%BD%91%E7%AB%99%E9%87%8D%E6%9E%84.html",{d:1706182936e3,e:`

网站重构

+

因原本的

+`,r:{minutes:.03,words:8},y:"a",t:"网站重构"},["/personalWebsite/10.网站重构.html","/personalWebsite/10.网站重构.md",":md"]],["v-65b5c81c","/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html",{d:1706182936e3,e:`

2.Lucene的使用

+

首先,帮忙点击一下我的网站http://www.wenzhihuai.com/ 。谢谢啊,如果可以,GitHub上麻烦给个star,以后面试能讲讲这个项目,GitHub地址https://github.com/Zephery/newblog

`,r:{minutes:6.8,words:2039},y:"a",t:"2.Lucene的使用"},["/personalWebsite/2.Lucene的使用.html","/personalWebsite/2.Lucene的使用.md",":md"]],["v-731a76b6","/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html",{d:1706182936e3,e:`

3.定时任务

+

先看一下Quartz的架构图:

+
+

一.特点:

+
    +
  1. 强大的调度功能,例如支持丰富多样的调度方法,可以满足各种常规及特殊需求;
  2. +
  3. 灵活的应用方式,例如支持任务和调度的多种组合方式,支持调度数据的多种存储方式;
  4. +
  5. 分布式和集群能力。
  6. +
`,r:{minutes:3.54,words:1063},y:"a",t:"3.定时任务"},["/personalWebsite/3.定时任务.html","/personalWebsite/3.定时任务.md",":md"]],["v-bea2ce1e","/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html",{d:1706182936e3,e:`

4.日志系统.md

+

欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog

`,r:{minutes:9.61,words:2883},y:"a",t:"4.日志系统.md"},["/personalWebsite/4.日志系统.html","/personalWebsite/4.日志系统.md",":md"]],["v-3efc517e","/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html",{d:1706182936e3,e:`

5.小集群部署.md

+

欢迎访问我的个人网站O(∩_∩)O哈哈~希望大佬们能给个star,个人网站网址:http://www.wenzhihuai.com,个人网站代码地址:https://github.com/Zephery/newblog
+洋洋洒洒的买了两个服务器,用来学习分布式、集群之类的东西,整来整去,感觉分布式这种东西没人指导一下真的是太抽象了,先从网站的分布式部署一步一步学起来吧,虽然网站本身的访问量不大==。

`,r:{minutes:9.47,words:2840},y:"a",t:"5.小集群部署.md"},["/personalWebsite/5.小集群部署.html","/personalWebsite/5.小集群部署.md",":md"]],["v-79ad699f","/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html",{d:1706182936e3,e:`

6.数据库备份

+

先来回顾一下上一篇的小集群架构,tomcat集群,nginx进行反向代理,服务器异地:

+
+

由上一篇讲到,部署的时候,将war部署在不同的服务器里,通过spring-session实现了session共享,基本的分布式部署还算是完善了点,但是想了想数据库的访问会不会延迟太大,毕竟一个服务器在北京,一个在深圳,然后试着ping了一下:

`,r:{minutes:5.74,words:1722},y:"a",t:"6.数据库备份"},["/personalWebsite/6.数据库备份.html","/personalWebsite/6.数据库备份.md",":md"]],["v-8658e60a","/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html",{d:1706182936e3,e:`

7.那些牛逼的插件

+

欢迎访问我的网站http://www.wenzhihuai.com/ 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblog
+建站的一开始,我也想自己全部实现,各种布局,各种炫丽的效果,想做点能让大家佩服的UI出来,但是,事实上,自己作为专注Java的程序员,前端的东西一碰脑子就有“我又不是前端,浪费时间在这合适么?”这种想法,捣鼓来捣鼓去,做出的东西实在是没法看,我就觉得,如果自己的“产品”连自己都看不下去了,那还好意思给别人看?特别是留言板那块,初版的页面简直low的要死。所以,还是踏踏实实的“站在巨人的肩膀上”吧,改用别人的插件。但不要纯粹的使用别人的博客模板了,如hexo,wordpress这些,就算是自己拼凑过来的也比这些强。下面是本博客中所用到的插件,给大家介绍介绍,共同学习学习。
+本站主要用到的插件有:
+1.wowslider
+2.畅言
+3.Editor.md
+4.highchart、echart
+5.百度分享
+6.waterfall.js
+7.心知天气
+8.标签云

`,r:{minutes:7.2,words:2161},y:"a",t:"7.那些牛逼的插件"},["/personalWebsite/7.那些牛逼的插件.html","/personalWebsite/7.那些牛逼的插件.md",":md"]],["v-7e9e4a32","/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html",{d:1706182936e3,e:`

8.基于贝叶斯的情感分析

+`,r:{minutes:.04,words:11},y:"a",t:"8.基于贝叶斯的情感分析"},["/personalWebsite/8.基于贝叶斯的情感分析.html","/personalWebsite/8.基于贝叶斯的情感分析.md",":md"]],["v-0b62f72e","/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html",{d:1706182936e3,e:`

9.网站性能优化

+`,r:{minutes:.02,words:7},y:"a",t:"9.网站性能优化"},["/personalWebsite/9.网站性能优化.html","/personalWebsite/9.网站性能优化.md",":md"]],["v-525c5e4d","/personalWebsite/",{d:1706182936e3,y:"a",t:""},["/personalWebsite/README.md"]],["v-dc384366","/redis/",{d:1706066758e3,y:"a",t:""},["/redis/README.md"]],["v-70796e0a","/redis/redis%E7%BC%93%E5%AD%98.html",{d:1706066758e3,e:`

一、概述

+

1.1 缓存介绍

+

系统的性能指标一般包括响应时间、延迟时间、吞吐量,并发用户数和资源利用率等。在应用运行过程中,我们有可能在一次数据库会话中,执行多次查询条件完全相同的SQL,MyBatis提供了一级缓存的方案优化这部分场景,如果是相同的SQL语句,会优先命中一级缓存,避免直接对数据库进行查询,提高性能。
+缓存常用语:
+数据不一致性、缓存更新机制、缓存可用性、缓存服务降级、缓存预热、缓存穿透
+可查看Redis实战(一) 使用缓存合理性

`,r:{minutes:11.96,words:3588},y:"a",t:"一、概述"},["/redis/redis缓存.html","/redis/redis缓存.md",":md"]],["v-60fc7530","/bigdata/spark/",{d:1706182936e3,y:"a",t:""},["/bigdata/spark/README.md"]],["v-04e32b44","/bigdata/spark/elastic-spark.html",{d:1706182936e3,e:`

elastic spark

+

Hadoop允许Elasticsearch在Spark中以两种方式使用:通过自2.1以来的原生RDD支持,或者通过自2.0以来的Map/Reduce桥接器。从5.0版本开始,elasticsearch-hadoop就支持Spark 2.0。目前spark支持的数据源有:
+(1)文件系统:LocalFS、HDFS、Hive、text、parquet、orc、json、csv
+(2)数据RDBMS:mysql、oracle、mssql
+(3)NOSQL数据库:HBase、ES、Redis
+(4)消息对象:Redis

`,r:{minutes:1.71,words:514},y:"a",t:"elastic spark"},[":md"]],["v-380c630d","/database/elasticsearch/",{d:1706092222e3,y:"a",t:""},["/database/elasticsearch/README.md"]],["v-d73a9aee","/database/elasticsearch/elasticsearch%E6%BA%90%E7%A0%81debug.html",{d:1706186538e3,e:`

【elasticsearch】源码debug

+

一、下载源代码

+

直接用idea下载代码https://github.com/elastic/elasticsearch.git
+

+

切换到特定版本的分支:比如7.17,之后idea会自己加上Run/Debug Elasitcsearch的,配置可以不用改,默认就好
+

+

二、修改设置(可选)

`,r:{minutes:.5,words:151},y:"a",t:"【elasticsearch】源码debug"},["/database/elasticsearch/elasticsearch源码debug.html","/database/elasticsearch/elasticsearch源码debug.md",":md"]],["v-3f2a15ee","/database/elasticsearch/%E3%80%90elasticsearch%E3%80%91%E6%90%9C%E7%B4%A2%E8%BF%87%E7%A8%8B%E8%AF%A6%E8%A7%A3.html",{d:1706183164e3,e:`

【elasticsearch】搜索过程详解

+

本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。

+

SearchType

+

QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。
+DFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。

`,r:{minutes:8.83,words:2650},y:"a",t:"【elasticsearch】搜索过程详解"},["/database/elasticsearch/【elasticsearch】搜索过程详解.html","/database/elasticsearch/【elasticsearch】搜索过程详解.md",":md"]],["v-aa93dec0","/database/mysql/1mysql.html",{d:1706092222e3,e:`

mysql

+
img
+`,r:{minutes:.01,words:3},y:"a",t:"mysql"},[":md"]],["v-21ba2ec8","/database/mysql/",{d:1706092222e3,y:"a",t:""},["/database/mysql/README.md"]],["v-3192e5a0","/database/mysql/gap%E9%94%81.html",{d:1706092222e3,e:`

gap锁

+`,r:{minutes:.01,words:2},y:"a",t:"gap锁"},["/database/mysql/gap锁.html","/database/mysql/gap锁.md",":md"]],["v-2675bfdc","/database/mysql/%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92explain.html",{d:1706092222e3,e:`

执行计划explain

+

第一次听到执行计划还是挺懵的,感觉像是存储函数什么样的东西,后来发现,居然是explain

+`,r:{minutes:.14,words:41},y:"a",t:"执行计划explain"},["/database/mysql/执行计划explain.html","/database/mysql/执行计划explain.md",":md"]],["v-0a0b7a54","/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html",{d:1706092222e3,e:`

数据库缓存

+

在MySQL 5.6开始,就已经默认禁用查询缓存了。在MySQL 8.0,就已经删除查询缓存功能了。

+

将select语句和语句的结果做hash映射关系后保存在一定的内存区域内。

+

禁用原因:

+

1.命中率低

+

2.写时所有都失效

+

禁用了:https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg。

`,r:{minutes:.34,words:101},y:"a",t:"数据库缓存"},["/database/mysql/数据库缓存.html","/database/mysql/数据库缓存.md",":md"]],["v-3706649a","/404.html",{y:"p",t:""},[]],["v-71b3ae87","/interview/",{y:"p",t:"Interview"},[]],["v-14c69af4","/java/",{y:"p",t:"Java"},[]],["v-25b47c13","/others/",{y:"p",t:"Others"},[]],["v-5bc93818","/category/",{y:"p",t:"分类",I:!1},[]],["v-744d024e","/tag/",{y:"p",t:"标签",I:!1},[]],["v-e52c881c","/article/",{y:"p",t:"文章",I:!1},[]],["v-154dc4c4","/star/",{y:"p",t:"星标",I:!1},[]],["v-01560935","/timeline/",{y:"p",t:"时间轴",I:!1},[]]];var Ai=M({name:"Vuepress",setup(){const e=Dp();return()=>i(e.value)}}),Jv=()=>Kv.reduce((e,[t,n,l,r])=>(e.push({name:t,path:n,component:Ai,meta:l},{path:n.endsWith("/")?n+"index.html":n.substring(0,n.length-5),redirect:n},...r.map(a=>({path:a===":md"?n.substring(0,n.length-5)+".md":a,redirect:n}))),e),[{name:"404",path:"/:catchAll(.*)",component:Ai}]),Yv=rf,Zv=()=>{const e=Hf({history:Yv(Ta("/")),routes:Jv(),scrollBehavior:(t,n,l)=>l||(t.hash?{el:t.hash}:{top:0})});return e.beforeResolve(async(t,n)=>{var l;(t.path!==n.path||n===wt)&&([t.meta._data]=await Promise.all([kt.resolvePageData(t.name),(l=Do[t.name])==null?void 0:l.__asyncLoader()]))}),e},Qv=e=>{e.component("ClientOnly",ar),e.component("Content",zo)},Xv=(e,t,n)=>{const l=li(()=>t.currentRoute.value.path),r=li(()=>kt.resolveRouteLocale(pn.value.locales,l.value)),a=Pa(l,()=>t.currentRoute.value.meta._data),s=_(()=>kt.resolveLayouts(n)),o=_(()=>kt.resolveSiteLocaleData(pn.value,r.value)),c=_(()=>kt.resolvePageFrontmatter(a.value)),u=_(()=>kt.resolvePageHeadTitle(a.value,o.value)),d=_(()=>kt.resolvePageHead(u.value,c.value,o.value)),p=_(()=>kt.resolvePageLang(a.value,o.value)),f=_(()=>kt.resolvePageLayout(a.value,s.value));return e.provide(Ip,s),e.provide(Mo,a),e.provide($o,c),e.provide(Pp,u),e.provide(Fo,d),e.provide(Vo,p),e.provide(No,f),e.provide(Ca,r),e.provide(Ho,o),Object.defineProperties(e.config.globalProperties,{$frontmatter:{get:()=>c.value},$head:{get:()=>d.value},$headTitle:{get:()=>u.value},$lang:{get:()=>p.value},$page:{get:()=>a.value},$routeLocale:{get:()=>r.value},$site:{get:()=>pn.value},$siteLocale:{get:()=>o.value},$withBase:{get:()=>xe}}),{layouts:s,pageData:a,pageFrontmatter:c,pageHead:d,pageHeadTitle:u,pageLang:p,pageLayout:f,routeLocale:r,siteData:pn,siteLocaleData:o}},e3=()=>{const e=Op(),t=Sa(),n=J([]),l=()=>{e.value.forEach(a=>{const s=t3(a);s&&n.value.push(s)})},r=()=>{document.documentElement.lang=t.value,n.value.forEach(a=>{a.parentNode===document.head&&document.head.removeChild(a)}),n.value.splice(0,n.value.length),e.value.forEach(a=>{const s=n3(a);s!==null&&(document.head.appendChild(s),n.value.push(s))})};ct($p,r),Ee(()=>{l(),r(),me(()=>e.value,r)})},t3=([e,t,n=""])=>{const l=Object.entries(t).map(([o,c])=>se(c)?`[${o}=${JSON.stringify(c)}]`:c===!0?`[${o}]`:"").join(""),r=`head > ${e}${l}`;return Array.from(document.querySelectorAll(r)).find(o=>o.innerText===n)||null},n3=([e,t,n])=>{if(!se(e))return null;const l=document.createElement(e);return La(t)&&Object.entries(t).forEach(([r,a])=>{se(a)?l.setAttribute(r,a):a===!0&&l.setAttribute(r,"")}),se(n)&&l.appendChild(document.createTextNode(n)),l},l3=yp,r3=async()=>{var n;const e=l3({name:"VuepressApp",setup(){var l;e3();for(const r of Pl)(l=r.setup)==null||l.call(r);return()=>[i(ec),...Pl.flatMap(({rootComponents:r=[]})=>r.map(a=>i(a)))]}}),t=Zv();Qv(e),Xv(e,t,Pl);for(const l of Pl)await((n=l.enhance)==null?void 0:n.call(l,{app:e,router:t,siteData:pn}));return e.use(t),{app:e,router:t}};r3().then(({app:e,router:t})=>{t.isReady().then(()=>{e.mount("#app")})});export{_o as a,Ie as b,s3 as c,r3 as createVueApp,Eo as d,i3 as e,a3 as o,Ke as r,Nd as w}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/index.html-bm3LruVY.js","assets/plugin-vue_export-helper-x3n3nnut.js","assets/home.html-UbXL2gcY.js","assets/index.html-Mm5OOXfz.js","assets/index.html-HlLxoAqK.js","assets/index.html-n0ldjUQW.js","assets/index.html-8ckAhyww.js","assets/devops-ping-tai.html-QDYIdDyo.js","assets/gitlab-ci.html-V0G7osrF.js","assets/jenkins-x.html-erfIag1T.js","assets/tekton.html-dabteeVs.js","assets/index.html-XmG6pc7W.js","assets/jvm.html-X0c_jgVl.js","assets/kafka.html-XPZSDjhE.js","assets/kubernetes.html-OuCY9z9N.js","assets/mysql.html-jTFKaNE3.js","assets/tiktok2023.html-T4HWHpaT.js","assets/JVM调优参数.html--Lh_8vXG.js","assets/lucene搜索原理.html-YL_BWWs1.js","assets/serverlog.html-IiWshuB0.js","assets/一次jvm调优过程.html-BEtyUgY9.js","assets/内存屏障.html-5JCsVv6o.js","assets/在 Spring 6 中使用虚拟线程.html-ix-0C20g.js","assets/基于kubernetes的分布式限流.html-tJsMLZCo.js","assets/index.html-oqBikOM4.js","assets/index.html-Dich0-0L.js","assets/spark on k8s operator.html-rCBkXzhV.js","assets/2017.html-AdKOrP-m.js","assets/2018.html-AaAxXJ4o.js","assets/2019.html-EnqiAe59.js","assets/index.html-P1jiBi7F.js","assets/index.html-94q5B7mi.js","assets/chatgpt.html-iY2QZYgv.js","assets/tesla.html-2Acqdst4.js","assets/1.历史与架构.html-piLOZJaO.js","assets/10.网站重构.html-B3DJ60R6.js","assets/2.Lucene的使用.html-dSBaVgnp.js","assets/3.定时任务.html-eD7hZxqJ.js","assets/4.日志系统.html-4izcXrKw.js","assets/5.小集群部署.html-giTxitnr.js","assets/6.数据库备份.html-2L7c0TUt.js","assets/7.那些牛逼的插件.html-WOroqLxh.js","assets/8.基于贝叶斯的情感分析.html-uHKTPHjR.js","assets/9.网站性能优化.html-oTS4TPN7.js","assets/index.html-bfztJVUA.js","assets/index.html-IkrxIkND.js","assets/redis缓存.html-iW7cH3sc.js","assets/index.html-K26-GfV4.js","assets/elastic-spark.html-qWo0Gzw1.js","assets/index.html-Kh7ogoCl.js","assets/elasticsearch源码debug.html-LzC5N4Nu.js","assets/【elasticsearch】搜索过程详解.html-qP1HLlwB.js","assets/1mysql.html-S53I0JMm.js","assets/index.html-lNr9aQbu.js","assets/gap锁.html-FsDBg4Au.js","assets/执行计划explain.html-DEhFzLaN.js","assets/数据库缓存.html-ELi5zypK.js","assets/404.html-EORHuK9s.js","assets/index.html-Liu-Smqv.js","assets/index.html-GFsHk5I4.js","assets/index.html-mwc9jQFp.js","assets/index.html-C3hdABea.js","assets/index.html-fplo8Du9.js","assets/index.html-b505XBQM.js","assets/index.html-TGCezLqp.js","assets/index.html-jiCpawhO.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} diff --git a/assets/chatgpt.html-iY2QZYgv.js b/assets/chatgpt.html-iY2QZYgv.js new file mode 100644 index 00000000..4c8c68ef --- /dev/null +++ b/assets/chatgpt.html-iY2QZYgv.js @@ -0,0 +1,110 @@ +import{_ as p}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as c,c as i,a as n,d as s,b as t,e}from"./app-hbwtiwmf.js";const l="/assets/vfh7kn-qq6FI6AK.png",r="/assets/1620-lNrDunpd.png",u="/assets/4yrkq1-e0bbXi2X.png",d="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAAGCBAMAAAAbF3R2AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURf///w2kfxweIHfFr9Db2enu7kpLTCaqh3p7fbKmqNckMYooWqgAAAnaSURBVHja7ZzNb+K6GsYtTTyCJWKuureqCHaDAmKbKaFDz8pXhZ52V0WAYHcRczRbhGgFO4QoKrM/izl/5X1fJ+G7nds5h0568/xKE5zYJn7y+LWdfggRE2q+6gpwGOl3H/25ByEOcpUXYqZUE0ocYjYV1/bk0Z9CigNRxxZpf0T7PLTY40blKPAIT8g2xNjvV6O8ldfsnpkLNXYHLFvnrFvr/lE9nCHw7JLOy5zVHJ5S+BlCnV1STZG37Mn9nVgo9Kw9dVrsHZFuTyW8s6/OqaC4I8S446YwH9zFyonFhNSZXLUsTHj2GE6tYVNYTepiHaixy1nOtdoPi1Ooc3A26Hd1ut3tptCzDqnj+d1aR49SLQrQYLdnTdN+x7W6qeZsADV2Ob8VFzTXOU3ZtoYa+0sJWmwtcm7KvoMYB4b0UWNhT8UZxDnEtVJqIKw2VlkHuRkPJ94Cw/kz9rFhnafts6xCBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADPUXd54+mXlfK8n/7Av1H0qFjL6Wq7YpgXIu2r6cuqGuZ++iqGdjzVSatT2l6pwaZiyhZypl6szs838W8Ie1zv+HxhZ1tKSD7m20v39dSJqXfMbSOjbMWY6wdSKP+KTYyrd8RMkUXYLJZXpWRDi4YQmjyVb8hGcCDYcGqVx6QaQvJJelv3AnU8YzfL7BpaBskovEf5uDh9h8ndouuLiAPn1KlICmHdq/ZUyHbzvCvu6aVUu9Ye0IEuBaf2neCD1r1vUx56J+47ItWe399xDe2ab4+4iTXVpjamTU2Uf+HnKHndtjum5dftpW/fUSVB8SB57SsumqspqpkvwnxAs9aJhzopCshp1aTQo1SOAnJO5TnuDCl5o1rmFKl3ahRccB5twhLd7ZS6pwwctHylbJcO0b7Jbgxy2bRvCck1NYP74Acn8qYrXZliYVFlPp2yhB/gx6SrcfNJIYrO85maSrrkHHc0uomdBrUjZUYzakxatSzfHg/VYK2OH6pjj33KNlR22wjMyanwuelcQfciaOs5n1dTlpk/4YrcSWK0w6JjpVxSdL6gi/CNVPEYtPLcu9LGJwNLqc6cm89xJ7jDPJrNbE0ypYyQrbU6ajI16jTFNU0MhuqO9NOrXOqBB0Tuuecc26iqJoX/wdo7TbJZXp/TJw/VA1Uz4DuVVrdUNDePz6A1s132iEWXr8Igbe4wiXJmu+a2uyQTz4qok63VCW4wTwcscgmPWTOTkZJRLqpAU85pGOHes0sj7wwo2WIlOR/v+SIkf8BLp1pHHLRsTQK9V53xWDUtbjE3zNzhK+XOckFwmpJM3G46vlantVJH+JE6mo0SaUh1z+zx+N50T1YnFaoTujIKelw0zerwRQRFRVwGLZeu9z3HRXXKHlh7h0QZ5oPgNJgFnUSs1KEudBuqE9gt9A4nWVuWmNUxFQ9MzzJyyJV3InVaZr5DKqWCi4iTOik1ort3pdrEyKgjI3UsNfKbQXBqkkx73hkc8I4beCe/8o6peLryzu22d263vcN5mz8xEz3ioNWhZlJTaQ6m5ZZ3pN8NFRjm/JZpj3VYHRnFHXsz7hjv2NWGXs2snvJOpM6dlELESR0aZ8K7aI0fVt4JrnAYLUXPbKPgrVm1Uq+iQhvq3NHhlXfeBy2OvMMdLT12Vz3rjk5oy9+JO2ZgozHrVsjxXZzUYQmoASpXrdGN3fIONdZ2w/tO1095vIWZnUwWalOd3HwYGoDU4VyzYFbE3qGBu25WK5F3guI73lH5CxqoaEzwaqG74rPSyhmN2oo8se2dq2hWljIy8ZSW9jyj3VKHmUbqRLlC71g+VZxf96zbIP9O3DGHNBVv+7YbK3XOzMXf0AR1JNbeMW9SKh8Fp9wqDz8Yy23FHVqUdcVKHR55RiKMTkZLe7oRd6guKr7Ts3JDU3N4EXFSR17wulhcPPL81KyReWPepIMVkgjF4jySd0uXltbWhRuqU10utVivuG+CmqLkxaQa1EFrdVOGintzYc1dk5TeVHhzy5SJLiKmD1KFjDYy6FC369XYBnrbe+520afQ4v+Lq2hKn9p6tLrbM12RSGZRw8+fWfkkVp3HSdgbauOnFXjuHAAAAAAAAAAAAAAAAAAAAACvhXSOSynuAtS96sEvc/Ly5Gvv68nxXlk33uJYrpCHvqS57vKRr77yMebqPHXC/IqJc+RPfxdzdepPhpxXUec/b9Q7DXjnGe/U4R3x9J+MmRN99Cx45+U9qwF14J2fVEe+StzBmJWw+c48Md5hdaxliH51dd7AmJX+a/mXwd3tWZtxx9KifuElSx32Tvr7b9/31NnzzqMW5+MRv1smS50/v628w51LrwJSpM61FhYJ85jInvX9t2/fAnVklcZyd887NS1SIy0mwb+3SI46jZ24Q+2v69111sVi6XKvGgc9KzljFntHboxZ0pPVvfnOzf1Sj8VCL+k7cXFnCy/85zCN7bgjm+I9WevKTZR3oicYmgj+Fq16YK5c03Iizt25ONeJi8pS8p+Ekzx7svXXi65HbyLG9J24+Y6RJ5Do6XVWejw138nzTkNq89pboyd9JbGKynrnT1zrUOdHa/TDz3f+wRH9rT7feWaN7sE7+HmWwHPl/202+JK4kxx18Fw5xnHnrfYseOeHI3rSf56FnvUcUj9xwuVNWSfbO9KrVqteffNV5wPBM7DPR/6d00LM1RFSNqIlOr14Q1sdBut3ztcN+l//aRzxpiHpjokAAAAAAAAAAAAAAAD8Io793wre9v8yeJf5lWRjrs7vv1SdEx1vdf4NdeAdqIOeBe/AO/AOvAPvwDtQB945vnf6Tm+dcDZXlAV4J+sVK+tUaePMhwK8k/2cqWROCpmTbI92rE6fGlmmHXmnn3jvfKbuVPQKxeIl7Tw2U4XT2Xqp0Pc+J907daeXvex/+uiUypVyI5MplovZS+f3kvOxUCw7SR+zHK+SrTiXpcwfzjuOO5VM/0PhhNIfChWn1Eu4d3onpS/1Iunwh0N9K3NS4dHqpFLMZMvVYqWX8LhTyJT6n/qFUu9L+ZK942Qc453evwqVnpP0uHPpXGYviwVWo+RQ3Ck5FUp/+sJxx6kkPe4UvXLGqRScTL/gVBwes8qZYqWQ9ZwCv8U6a81mmDnBOgvrLKgD78A78A68A+/AO/AOvAPvQB2o8wPe9X6lOn0Rc+reL0QLAMDb4L8JWctvGtyeVAAAAABJRU5ErkJggg==",k="/assets/28gfhn-5aEotGhL.png",m="/assets/mrw3cz-WdJLjmEt.png",A="/assets/ykhrvs-Zpp9tS7m.png",v="/assets/svjm7s-bmJG6WtQ.png",h="/assets/kkjdna-1t0PmkAn.png",g="/assets/wfekdb-J8GFOYNE.png",b="/assets/129qih-to9xnaLl.png",y="/assets/dn1f67-ts10HlrI.png",f="/assets/p82i06-OkAl2TIG.png",_="/assets/eeogjb-u6mCBYaH.png",E="/assets/52pp5f-0miE36nj.png",w="/assets/qh4efq-HCV-SN0f.png",x="/assets/4hod0s-E_0zvkjv.png",q={},T=e('

微信公众号-chatgpt智能客服搭建

想体验的可以去微信上搜索【旅行的树】公众号。

一、ChatGPT注册

1.1 短信手机号申请

openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。

国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。

',6),j={href:"https://sms-activate.org",target:"_blank",rel:"noopener noreferrer"},I=e('image-20230220172107296

之后再搜索框填openai进行下单购买即可。

img

1.2 云服务器申请

openai在国内不提供服务的,而且也通过ip识别是不是在国内,解决办法用vpn也行,或者,自己去买一台国外的服务器也行。我这里使用的是腾讯云轻量服务器,最低配置54元/月,选择windows的主要原因毕竟需要注册openai,需要看页面,同时也可以搭建nginx,当然,用ubuntu如果能自己搞界面也行。

image-20230221193455384

1.3 ChatGPT注册

',7),S={href:"https://platform.openai.com/signup%E5%AE%98%E7%BD%91%E9%87%8C%E6%B3%A8%E5%86%8C%EF%BC%8C%E6%B3%A8%E5%86%8C%E8%BF%87%E7%A8%8B%E5%85%B7%E4%BD%93%E5%B0%B1%E4%B8%8D%E8%AE%B2%E4%BA%86%EF%BC%8C%E8%AE%B2%E4%B8%8B%E6%A0%B8%E5%BF%83%E9%97%AE%E9%A2%98%E2%80%94%E2%80%94%E7%9F%AD%E4%BF%A1%E9%AA%8C%E8%AF%81%E7%A0%81",target:"_blank",rel:"noopener noreferrer"},B=e('image-20230222104357230

然后回sms查看验证码。

image-20230222104225722

注册成功之后就可以在chatgpt里聊天啦,能够识别各种语言,发起多轮会话的时候,可能回出现访问超过限制什么的。

image-20230220173335691

通过chatgpt聊天不是我们最终想要的,我们需要的是在微信公众号也提供智能客服的聊天回复,所以我们需要在通过openai的api来进行调用。

image-20230222104316514

二、搭建nginx服务器

跟页面一样,OpenAI的调用也是不能再国内访问的,这里,我们使用同一台服务器来搭建nginx,还是保留使用windows吧,主要还是得注意下面这段话,如果API key被泄露了,OpenAI可能会自动重新更新你的API key,这个规则似乎是API key如果被多个ip使用,就会触发这个规则,调试阶段还是尽量使用windows的服务器吧,万一被更新了,还能去页面上重新找到。

Do not share your API key with others, or expose it in the browser or other client-side code. In order to protect the security of your account, OpenAI may also automatically rotate any API key that we've found has leaked publicly.
+

windows的安装过程参考网上的来,我们只需要添加下面这个配置即可,原理主要是将调用OpenAI的接口全部往官网转发。

    location /v1/completions {
+      proxy_pass https://api.openai.com/v1/completions;
+    }
+

然后使用下面的方法进行调试即可:

POST http://YOUR IP/v1/completions
+Authorization: Bearer YOUR_API_KEY
+Content-Type: application/json
+
+{
+  "model": "text-davinci-003",
+  "prompt": "Say this is a test",
+  "max_tokens": 7,
+  "temperature": 0
+}
+

三、公众号开发

网上有很多关于微信通过chatgpt回复的文章,有些使用自己微信号直接做为载体,因为要扫码网页登陆,而且是网页端在国外,很容易被封;有些是使用公众号,相对来说,公众号被封也不至于导致个人微信号出问题。

3.1 微信云托管

微信公众平台提供了微信云托管,无需鉴权,比其他方式都方便不少,可以免费试用3个月,继续薅羊毛,当然,如果自己开发能力足够,也可以自己从0开始开发。

image-20230220192603751

提供了各种语言的模版,方便快速开发,OpenAI官方提供的sdk是node和python,这里我们选择express(node)。

image-20230220201004069

3.2 一个简单ChatGPT简单回复

',22),z={href:"https://github.com/WeixinCloud/wxcloudrun-express%EF%BC%8C%E6%88%91%E4%BB%AC%E7%9B%B4%E6%8E%A5fork%E4%B8%80%E4%BB%BD%E8%87%AA%E5%B7%B1%E6%9D%A5%E5%BC%80%E5%8F%91%E3%80%82",target:"_blank",rel:"noopener noreferrer"},C=e(`

一个简单的消息回复功能(无db),直接在我们的index.js里添加如下代码。

const configuration = new Configuration({
+    apiKey: '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',
+    basePath: 'http://43.153.15.174/v1'
+});
+const openai = new OpenAIApi(configuration);
+
+async function simpleResponse(prompt) {
+    const completion = await openai.createCompletion({
+        model: 'text-davinci-003',
+        prompt,
+        max_tokens: 1024,
+        temperature: 0.1,
+    });
+    const response = (completion?.data?.choices?.[0].text || 'AI 挂了').trim();
+    return strip(response, ['\\n', 'A: ']);
+}
+
+app.post("/message/simple", async (req, res) => {
+    console.log('消息推送', req.body)
+    // 从 header 中取appid,如果 from-appid 不存在,则不是资源复用场景,可以直接传空字符串,使用环境所属账号发起云调用
+    const appid = req.headers['x-wx-from-appid'] || ''
+    const {ToUserName, FromUserName, MsgType, Content, CreateTime} = req.body
+    console.log('推送接收的账号', ToUserName, '创建时间', CreateTime)
+    if (MsgType === 'text') {
+        message = await simpleResponse(Content)
+        res.send({
+            ToUserName: FromUserName,
+            FromUserName: ToUserName,
+            CreateTime: CreateTime,
+            MsgType: 'text',
+            Content: message,
+        })
+    } else {
+        res.send('success')
+    }
+})
+

本地可以直接使用http请求测试,成功调用之后直接提交发布即可,在微信云托管上需要先授权代码库,即可使用云托管的流水线,一键发布。注意,api_base和api_key可以填写在服务设置-基础信息那里,一个是OPENAI_API_BASE,一个是OPENAI_API_KEY,服务会自动从环境变量里取。

3.3 服务部署

提交代码只github或者gitee都可以,值得注意的是,OpenAI判断key泄露的规则,不知道是不是判断调用的ip地址不一样,还是github的提交记录里含有这块,有点玄学,同样的key本地调用一次,然后在云托管也调用的话,OpenAI就很容易把key给重新更新。

image-20230220203313790

部署完之后,云托管也提供了云端调试功能,相当于在服务里发送了http请求。这一步很重要,如果没有调用成功,则无法进行云托管消息推送。

image-20230220203711436

这里填上你自己的url,我们这里配置的是/meesage/simple,如果没有成功,需要进行下面步骤进行排查:

(1)服务有没有正常启动,看日志

(2)端口有没有设置错误,这个很多次没有注意到

image-20230220203445297

保存成功之后,就可以在微信公众号里测试了。

image-20230221134250689

体验还可以

四、没有回复(超时回复问题)

很多OpenAI的回答都要几十秒,有的甚至更久,比如对chatgpt问“写一篇1000字关于深圳的文章”,就需要几十秒,而微信的主动回复接口,是需要我们3s内返回给用户。

订阅号的消息推送分几种:

  1. 被动消息回复:指用户给公众号发一条消息,系统接收到后,可以回复一条消息。
  2. 主动回复/客服消息:可以脱离被动消息的5秒超时权限,在48小时内可以主动回复。但需要公众号完成微信认证。
',19),N={href:"https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Explanation_of_interface_privileges.html",target:"_blank",rel:"noopener noreferrer"},U=e('image-20230221100251825

对于有微信认证的订阅号或者服务号,可以调用微信官方的/cgi-bin/message/custom/send接口来实现主动回复,但是对于个人的公众号,没有权限调用,只能尝试别的办法。想来想去,只能在3s内返回让用户重新复制发送的信息,同时后台里保存记录异步调用,用户重新发送的时候再从数据库里提取回复。

1.先往数据库存一条 回复记录,把用户的提问存下来,以便后续查询。设置回复的内容为空,设置状态为 回复中(thinking)。

  // 因为AI响应比较慢,容易超时,先插入一条记录,维持状态,待后续更新记录。
+  await Message.create({
+    fromUser: FromUserName,
+    response: '',
+    request: Content,
+    aiType: AI_TYPE_TEXT, // 为其他AI回复拓展,比如AI作画
+  });
+

2.抽象一个 chatGPT 请求方法 getAIMessage,函数内部得到 GPT 响应后,会更新之前那条记录(通过用户id & 用户提问 查询),把状态更新为 已回答(answered),并把回复内容更新上。

 // 成功后,更新记录
+  await Message.update(
+    {
+      response: response,
+      status: MESSAGE_STATUS_ANSWERED,
+    },
+    {
+      where: {
+        fromUser: FromUserName,
+        request: Content,
+      },
+    },
+  );
+

3.前置增加一些判断,当用户在请求时,如果 AI 还没完成响应,直接回复用户 AI 还在响应,让用户过一会儿再重试。如果 AI 此时已响应完成,则直接把 内容返回给用户。

  // 找一下,是否已有记录
+  const message = await Message.findOne({
+    where: {
+      fromUser: FromUserName,
+      request: Content,
+    },
+  });
+
+  // 已回答,直接返回消息
+  if (message?.status === MESSAGE_STATUS_ANSWERED) {
+    return \`[GPT]: \${message?.response}\`;
+  }
+
+  // 在回答中
+  if (message?.status === MESSAGE_STATUS_THINKING) {
+    return AI_THINKING_MESSAGE;
+  }
+

4.最后就是一个 Promise.race

  const message = await Promise.race([
+    // 3秒微信服务器就会超时,超过2.9秒要提示用户重试
+    sleep(2900).then(() => AI_THINKING_MESSAGE),
+    getAIMessage({ Content, FromUserName }),
+  ]);
+

这样子大概就能实现超时之前返回了。

五、会话保存

掉接口是一次性的,一次接口调用完之后怎么做到下一次通话的时候,还能继续保持会话,是不是应该类似客户端与服务端那种有个session这种,但是实际上在openai里是没有session这种东西的,令人震惊的是,chatgpt里是通过前几次会话拼接起来一起发送给chatgpt里的,需要通过回车符来拼接。

async function buildCtxPrompt({ FromUserName }) {
+  // 获取最近10条对话
+  const messages = await Message.findAll({
+    where: {
+      fromUser: FromUserName,
+      aiType: AI_TYPE_TEXT,
+    },
+    limit: 10,
+    order: [['updatedAt', 'ASC']],
+  });
+  // 只有一条的时候,就不用封装上下文了
+  return messages.length === 1
+    ? messages[0].request
+    : messages
+        .map(({ response, request }) => \`Q: \${request}\\n A: \${response}\`)
+        .join('\\n');
+}
+

之后就可以实现会话之间的保存通信了。

image-20230218203309437

六、其他问题

6.1 限频

chatgpt毕竟也是新上线的,火热是肯定的,聊天窗口只能开几个,api调用的话,也是有限频的,但是规则具体没有找到,只是在调用次数过多的时候会报429的错误,出现之后就需要等待一个小时左右。

对于这个的解决办法只能是多开几个账号,一旦429就只能换个账号重试了。

6.2 秘钥key被更新

没有找到详细的规则,凭个人经验的话,可能github提交的代码会被扫描,可能ip调用的来源不一样,最好还是开发一个秘钥,生产一个秘钥吧。

6.3 为啥和官网的回复不一样

',23),F={href:"https://platform.openai.com/docs/models/overview%EF%BC%8C%E4%B9%9F%E7%AE%97%E6%98%AF%E4%B8%80%E4%B8%AA%E6%AF%94%E8%BE%83%E8%80%81%E7%9A%84%E6%A0%B7%E6%9C%AC%E4%BA%86%E5%90%A7",target:"_blank",rel:"noopener noreferrer"},V=n("img",{src:w,alt:"image-20230221192417900",style:{zoom:"50%"}},null,-1),O=n("code",null,"text-davinci-003",-1),K={href:"https://link.juejin.cn/?target=https%3A%2F%2Fplatform.openai.com%2Fdocs%2Fguides%2Ffine-tuning",target:"_blank",rel:"noopener noreferrer"},J=n("h3",{id:"_6-4-玄学挂掉",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#_6-4-玄学挂掉","aria-hidden":"true"},"#"),s(" 6.4 玄学挂掉")],-1),H=n("p",null,"有时候消息没有回复,真的不是我们的问题,chatgpt毕竟太火了,官网的这个能力都经常挂掉,也可以订阅官网修复的通知,一旦修复则会发邮件告知你。",-1),P=n("img",{src:x,alt:"image-20230221175150025",style:{zoom:"50%"}},null,-1),X={href:"https://juejin.cn/post/7200769439335546935",target:"_blank",rel:"noopener noreferrer"},R=n("h2",{id:"最后",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#最后","aria-hidden":"true"},"#"),s(" 最后")],-1),Y=n("br",null,null,-1),G={href:"https://github.com/Zephery/wechat-gpt",target:"_blank",rel:"noopener noreferrer"};function W(L,Z){const a=o("ExternalLinkIcon");return c(),i("div",null,[T,n("p",null,[s("国外手机号,没有的话也可以去"),n("a",j,[s("https://sms-activate.org"),t(a)]),s(",费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。")]),I,n("p",null,[s("购买完之后,就可以直接打开openai的官网了,然后去"),n("a",S,[s("https://platform.openai.com/signup官网里注册,注册过程具体就不讲了,讲下核心问题——短信验证码"),t(a)])]),B,n("p",null,[s("微信官方的源码在这,"),n("a",z,[s("https://github.com/WeixinCloud/wxcloudrun-express,我们直接fork一份自己来开发。"),t(a)])]),C,n("p",null,[s("根据微信官方文档,没有认证的公众号是没有调用主动回复接口权限的,"),n("a",N,[s("https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Explanation_of_interface_privileges.html"),t(a)])]),U,n("p",null,[s("我们这里用的模型算法是text-davinci-003,具体可以参考:"),n("a",F,[s("https://platform.openai.com/docs/models/overview,也算是一个比较老的样本了吧"),t(a)])]),V,n("p",null,[s("从官方文档来看,官方服务版的 ChatGPT 的模型并非基础版的"),O,s(",而是经过了「微调:fine-tunes」。文档地址在这:"),n("a",K,[s("platform.openai.com/docs/guides…"),t(a)])]),J,H,P,n("p",null,[s("参考:"),n("a",X,[s("https://juejin.cn/post/7200769439335546935"),t(a)])]),R,n("p",null,[s("记得去微信关注【旅行的树】公众号体验"),Y,s(" 代码地址:"),n("a",G,[s("https://github.com/Zephery/wechat-gpt"),t(a)])])])}const Q=p(q,[["render",W],["__file","chatgpt.html.vue"]]);export{Q as default}; diff --git a/assets/chatgpt.html-sGHN-7nl.js b/assets/chatgpt.html-sGHN-7nl.js new file mode 100644 index 00000000..480faf67 --- /dev/null +++ b/assets/chatgpt.html-sGHN-7nl.js @@ -0,0 +1 @@ +const t=JSON.parse('{"key":"v-510415f9","path":"/others/chatgpt.html","title":"微信公众号-chatgpt智能客服搭建","lang":"zh-CN","frontmatter":{"description":"微信公众号-chatgpt智能客服搭建 想体验的可以去微信上搜索【旅行的树】公众号。 一、ChatGPT注册 1.1 短信手机号申请 openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。 国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。 国外手机号,没有的话也可以去https://sms-activate.org,费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/others/chatgpt.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"微信公众号-chatgpt智能客服搭建"}],["meta",{"property":"og:description","content":"微信公众号-chatgpt智能客服搭建 想体验的可以去微信上搜索【旅行的树】公众号。 一、ChatGPT注册 1.1 短信手机号申请 openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。 国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。 国外手机号,没有的话也可以去https://sms-activate.org,费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T12:53:13.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T12:53:13.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"微信公众号-chatgpt智能客服搭建\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T12:53:13.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、ChatGPT注册","slug":"一、chatgpt注册","link":"#一、chatgpt注册","children":[{"level":3,"title":"1.1 短信手机号申请","slug":"_1-1-短信手机号申请","link":"#_1-1-短信手机号申请","children":[]},{"level":3,"title":"1.2 云服务器申请","slug":"_1-2-云服务器申请","link":"#_1-2-云服务器申请","children":[]},{"level":3,"title":"1.3 ChatGPT注册","slug":"_1-3-chatgpt注册","link":"#_1-3-chatgpt注册","children":[]}]},{"level":2,"title":"二、搭建nginx服务器","slug":"二、搭建nginx服务器","link":"#二、搭建nginx服务器","children":[]},{"level":2,"title":"三、公众号开发","slug":"三、公众号开发","link":"#三、公众号开发","children":[{"level":3,"title":"3.1 微信云托管","slug":"_3-1-微信云托管","link":"#_3-1-微信云托管","children":[]},{"level":3,"title":"3.2 一个简单ChatGPT简单回复","slug":"_3-2-一个简单chatgpt简单回复","link":"#_3-2-一个简单chatgpt简单回复","children":[]},{"level":3,"title":"3.3 服务部署","slug":"_3-3-服务部署","link":"#_3-3-服务部署","children":[]}]},{"level":2,"title":"四、没有回复(超时回复问题)","slug":"四、没有回复-超时回复问题","link":"#四、没有回复-超时回复问题","children":[]},{"level":2,"title":"五、会话保存","slug":"五、会话保存","link":"#五、会话保存","children":[]},{"level":2,"title":"六、其他问题","slug":"六、其他问题","link":"#六、其他问题","children":[{"level":3,"title":"6.1 限频","slug":"_6-1-限频","link":"#_6-1-限频","children":[]},{"level":3,"title":"6.2 秘钥key被更新","slug":"_6-2-秘钥key被更新","link":"#_6-2-秘钥key被更新","children":[]},{"level":3,"title":"6.3 为啥和官网的回复不一样","slug":"_6-3-为啥和官网的回复不一样","link":"#_6-3-为啥和官网的回复不一样","children":[]},{"level":3,"title":"6.4 玄学挂掉","slug":"_6-4-玄学挂掉","link":"#_6-4-玄学挂掉","children":[]}]},{"level":2,"title":"最后","slug":"最后","link":"#最后","children":[]}],"git":{"createdTime":1706186538000,"updatedTime":1706187193000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":9.66,"words":2899},"filePathRelative":"others/chatgpt.md","localizedDate":"2024年1月25日","excerpt":"

微信公众号-chatgpt智能客服搭建

\\n

想体验的可以去微信上搜索【旅行的树】公众号。

\\n

一、ChatGPT注册

\\n

1.1 短信手机号申请

\\n

openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。

\\n

国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。

\\n

国外手机号,没有的话也可以去https://sms-activate.org,费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。

","autoDesc":true}');export{t as data}; diff --git a/assets/devops-ping-tai.html-QDYIdDyo.js b/assets/devops-ping-tai.html-QDYIdDyo.js new file mode 100644 index 00000000..25ca31f9 --- /dev/null +++ b/assets/devops-ping-tai.html-QDYIdDyo.js @@ -0,0 +1,246 @@ +import{_ as i}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as l,o as p,c,a as n,d as s,b as e,e as t}from"./app-hbwtiwmf.js";const o={},u={id:"_3-1-devops平台-md",tabindex:"-1"},d=n("a",{class:"header-anchor",href:"#_3-1-devops平台-md","aria-hidden":"true"},"#",-1),r={href:"http://xn--DevOps-gc6jn80e.md",target:"_blank",rel:"noopener noreferrer"},v=n("p",null,"DevOps定义(来自维基百科): DevOps(Development和Operations的组合词)是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。",-1),m=n("p",null,"公司技术部目前几百人左右吧,但是整个技术栈还是比较落后的,尤其是DevOps、容器这一块,需要将全线打通,当时进来也主要是负责DevOps这一块的工作,应该说也是没怎么做好,其中也走了不少弯路,下面主要是自己踩过的坑吧。",-1),g=n("h2",{id:"一、自由风格的软件项目",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#一、自由风格的软件项目","aria-hidden":"true"},"#"),s(" 一、自由风格的软件项目")],-1),k={href:"https://www.cnblogs.com/w1570631036/p/9861473.html",target:"_blank",rel:"noopener noreferrer"},b=t(`

完成了以上的东西,不过由于太过于简单,导致只能进行单条线的CICD,而且CI仅仅实现了打包,没有将CD的过程一同串行起来。简单来说就是,用户点击了构建只是能够打出一个镜像,但是如果要部署到kubernetes,还是需要在应用里手动更换一下镜像版本。总体而言,这个版本的jenkins我们使用的还是单点的,不足以支撑构建量比较大的情况,甚至如果当前服务挂了,断网了,整一块的构建功能都不能用。

<project>
+    <actions/>
+    <description>xxx</description>
+    <properties>
+        <hudson.model.ParametersDefinitionProperty>
+            <parameterDefinitions>
+                <hudson.model.TextParameterDefinition>
+                    <name>buildParam</name>
+                    <defaultValue>v1</defaultValue>
+                </hudson.model.TextParameterDefinition>
+                <hudson.model.TextParameterDefinition>
+                    <name>codeBranch</name>
+                    <defaultValue>master</defaultValue>
+                </hudson.model.TextParameterDefinition>
+            </parameterDefinitions>
+        </hudson.model.ParametersDefinitionProperty>
+    </properties>
+    <scm class="hudson.plugins.git.GitSCM">
+        <configVersion>2</configVersion>
+        <userRemoteConfigs>
+            <hudson.plugins.git.UserRemoteConfig>
+                <url>http://xxxxx.git</url>
+                <credentialsId>002367566a4eb4bb016a4eb723550054</credentialsId>
+            </hudson.plugins.git.UserRemoteConfig>
+        </userRemoteConfigs>
+        <branches>
+            <hudson.plugins.git.BranchSpec>
+                <name>\${codeBranch}</name>
+            </hudson.plugins.git.BranchSpec>
+        </branches>
+        <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
+        <extensions/>
+    </scm>
+    <builders>
+        <hudson.tasks.Shell>
+            <command>ls</command>
+        </hudson.tasks.Shell>
+        <hudson.tasks.Maven>
+            <targets>clean package install -Dmaven.test.skip=true</targets>
+            <mavenName>mvn3.5.4</mavenName>
+        </hudson.tasks.Maven>
+        <com.cloudbees.dockerpublish.DockerBuilder>
+            <server>
+                <uri>unix:///var/run/docker.sock</uri>
+            </server>
+            <registry>
+                <url>http://xxxx</url>
+            </registry>
+            <repoName>xxx/xx</repoName>
+            <forcePull>true</forcePull>
+            <dockerfilePath>Dockerfile</dockerfilePath>
+            <repoTag>\${buildParam}</repoTag>
+            <skipTagLatest>true</skipTagLatest>
+        </com.cloudbees.dockerpublish.DockerBuilder>
+    </builders>
+    <publishers>
+        <com.xxxx.notifications.Notifier/>
+    </publishers>
+</project>
+

二、优化之后的CICD

上面的过程也仍然没有没住DevOps的流程,人工干预的东西依旧很多,由于上级急需产出,所以只能将就着继续下去。我们将构建、部署每个当做一个小块,一个CICD的过程可以选择构建、部署,花了很大的精力,完成了串行化的别样的CICD。 以下图为例,整个流程的底层为:paas平台-jenkins-kakfa-管理平台(选择cicd的下一步)-kafka-cicd组件调用管理平台触发构建-jenkins-kafka-管理平台(选择cicd的下一步)-kafka-cicd组件调用管理平台触发部署。

目前实现了串行化的CICD构建部署,之后考虑实现多个CICD并行,并且一个CICD能够调用另一个CICD,实际运行中,出现了一大堆问题。由于经过的组件太多,一次cicd的运行报错,却很难排查到问题出现的原因,业务方的投诉也开始慢慢多了起来,只能说劝导他们不要用这个功能。

没有CICD,就无法帮助公司上容器云,无法合理的利用容器云的特性,更无法走上云原生的道路。于是,我们决定另谋出路。

三、调研期

由于之前的CICD问题太多,特别是经过的组件太多了,导致出现问题的时候无法正常排查,为了能够更加稳定可靠,还是决定了要更换一下底层。 我们重新审视了下pipeline,觉得这才是正确的做法,可惜不知道如果做成一个产品样子的东西,用户方Dockerfile都不怎么会写,你让他写一个Jenkinsfile?不合理!在此之外,我们看到了serverless jenkins、谷歌的tekton。 GitLab-CICD Gitlab中自带了cicd的工具,需要配置一下runner,然后配置一下.gitlab-ci.yml写一下程序的cicd过程即可,构建镜像的时候我们使用的是kaniko,整个gitlab的cicd在我们公司小项目中大范围使用,但是学习成本过高,尤其是引入了kaniko之后,还是寻找一个产品化的CICD方案。

`,9),h=n("strong",null,"分布式构建jenkins x",-1),x={href:"https://github.com/jenkins-x/jenkins-x-image",target:"_blank",rel:"noopener noreferrer"},f=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/201908170612301464716259.png",alt:"",tabindex:"0"}),n("figcaption")],-1),q=n("p",null,[n("strong",null,"serverless jenkins"),s(" 好像跟谷歌的tekton相关,用了下,没调通,只能用于GitHub。感觉还不如直接使用tekton。")],-1),_=n("p",null,[n("strong",null,"阿里云云效"),s(" 提供了图形化配置DevOps流程,支持定时触发,可惜没有跟gitlab触发结合,如果需要个公司级的DevOps,需要将公司的jira、gitlab、jenkins等集合起来,但是图形化jenkins pipeline是个特别好的参考方向,可以结合阿里云云效来做一个自己的DevOps产品。")],-1),D=n("p",null,[n("strong",null,"微软Pipeline"),s(" 微软也是提供了DevOps解决方案的,也是提供了yaml格式的写法,即:在右边填写完之后会转化成yaml。如果想把DevOps打造成一款产品,这样的设计显然不是最好的。")],-1),j=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/201908100346011648784131.png",alt:"",tabindex:"0"}),n("figcaption")],-1),C=n("strong",null,"谷歌tekton",-1),w={href:"https://www.jianshu.com/p/8871b7ea7d6e",target:"_blank",rel:"noopener noreferrer"},y=t(`

四、产品化后的DevOps平台

在调研DockOne以及各个产商的DevOps产品时,发现,真的只有阿里云的云效才是真正比较完美的DevOps产品,用户不需要知道pipeline的语法,也不需要掌握kubernetes的相关知识,甚至不用写yaml文件,对于开发、测试来说简直就是神一样的存在了。云效对小公司(创业公司)免费,但是有一定的量之后,就要开始收费了。在调研了一番云效的东西之后,发现云效也是基于jenkins x改造的,不过阿里毕竟人多,虽然能约莫看出是pipeline的语法,但是阿里彻底改造成了能够使用yaml来与后台交互。 下面是以阿里云的云效界面以及配合jenkins的pipeline语法来讲解:

4.1 Java代码扫描

PMD是一款可拓展的静态代码分析器它不仅可以对代码分析器,它不仅可以对代码风格进行检查,还可以检查设计、多线程、性能等方面的问题。阿里云的是简单的集成了一下而已,对于我们来说,底层使用了sonar来接入,所有的代码扫描结果都接入了sonar。

stage('Clone') {
+    steps{
+        git branch: 'master', credentialsId: 'xxxx', url: "xxx"
+    }
+}
+stage('check') {
+    steps{
+        container('maven') {
+            echo "mvn pmd:pmd"
+        }
+    }
+}
+

4.2 Java单元测试

Java的单元测试一般用的是Junit,在阿里云中,使用了surefire插件,用来在maven构建生命周期的test phase执行一个应用的单元测试。它会产生两种不同形式的测试结果报告。我这里就简单的过一下,使用"mvn test"命令来代替。


+stage('Clone') {
+    steps{
+        echo "1.Clone Stage"
+        git branch: 'master', credentialsId: 'xxxxx', url: "xxxxxx"
+    }
+}
+stage('test') {
+    steps{
+        container('maven') {
+            sh "mvn test"
+        }
+    }
+}
+

4.3 Java构建并上传镜像

镜像的构建比较想使用kaniko,尝试找了不少方法,到最后还是只能使用dind(docker in docker),挂载宿主机的docker来进行构建,如果能有其他方案,希望能提醒下。目前jenkins x使用的是dind,挂载的时候需要配置一下config.json,然后挂载到容器的/root/.docker目录,才能在容器中使用docker。

为什么不推荐dind:挂载了宿主机的docker,就可以使用docker ps查看正在运行的容器,也就意味着可以使用docker stop、docker rm来控制宿主机的容器,虽然kubernetes会重新调度起来,但是这一段的重启时间极大的影响业务。


+stage('下载代码') {
+    steps{
+        echo "1.Clone Stage"
+        git branch: 'master', credentialsId: 'xxxxx', url: "xxxxxx"
+        script {
+            build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
+        }
+    }
+}
+stage('打包并构建镜像') {
+    steps{
+        container('maven') {
+            echo "3.Build Docker Image Stage"
+            sh "mvn clean install -Dmaven.test.skip=true"
+            sh "docker build -f xxx/Dockerfile -t xxxxxx:\${build_tag} ."
+            sh "docker push xxxxxx:\${build_tag}"
+        }
+    }
+}
+
+

4.4 部署到阿里云k8s

CD过程有点困难,由于我们的kubernetes平台是图形化的,类似于阿里云,用户根本不需要自己写deployment,只需要在图形化界面做一下操作即可部署。对于CD过程来说,如果应用存在的话,就可以直接替换掉镜像版本即可,如果没有应用,就提供个简单的界面让用户新建应用。当然,在容器最初推行的时候,对于用户来说,一下子需要接受docker、kubernetes、helm等概念是十分困难的,不能一个一个帮他们写deployment这些yaml文件,只能用helm创建一个通用的spring boot或者其他的模板,然后让业务方修改自己的配置,每次构建的时候只需要替换镜像即可。

def tmp = sh (
+    returnStdout: true,
+    script: "kubectl get deployment -n \${namespace} | grep \${JOB_NAME} | awk '{print \\$1}'"
+)
+//如果是第一次,则使用helm模板创建,创建完后需要去epaas修改pod的配置
+if(tmp.equals('')){
+    sh "helm init --client-only"
+    sh """helm repo add mychartmuseum http://xxxxxx \\
+                       --username myuser \\
+                       --password=mypass"""
+    sh """helm install --set name=\${JOB_NAME} \\
+                       --set namespace=\${namespace} \\
+                       --set deployment.image=\${image} \\
+                       --set deployment.imagePullSecrets=\${harborProject} \\
+                       --name \${namespace}-\${JOB_NAME} \\
+                       mychartmuseum/soa-template"""
+}else{
+    println "已经存在,替换镜像"
+    //epaas中一个pod的容器名称需要带上"-0"来区分
+    sh "kubectl set image deployment/\${JOB_NAME} \${JOB_NAME}-0=\${image} -n \${namespace}"
+}
+
+

4.5 整体流程

代码扫描,单元测试,构建镜像三个并行运行,等三个完成之后,在进行部署

pipeline:

pipeline {
+    agent {
+        label "jenkins-maven"
+    }
+    stages{
+        stage('代码扫描,单元测试,镜像构建'){
+            parallel {
+                stage('并行任务一') {
+                    agent {
+                        label "jenkins-maven"
+                    }
+                    stages('Java代码扫描') {
+                        stage('Clone') {
+                            steps{
+                                git branch: 'master', credentialsId: 'xxxxxxx', url: "xxxxxxx"
+                            }
+                        }
+                        stage('check') {
+                            steps{
+                                container('maven') {
+                                    echo "$BUILD_NUMBER"
+                                }
+                            }
+                        }
+                    }
+                }
+                stage('并行任务二') {
+                    agent {
+                        label "jenkins-maven"
+                    }
+                    stages('Java单元测试') {
+                        stage('Clone') {
+                            steps{
+                                echo "1.Clone Stage"
+                                git branch: 'master', credentialsId: 'xxxxxxx', url: "xxxxxxx"
+                            }
+                        }
+                        stage('test') {
+                            steps{
+                                container('maven') {
+                                    echo "3.Build Docker Image Stage"
+                                    sh "mvn -v"
+                                }
+                            }
+                        }
+                    }
+                }
+                stage('并行任务三') {
+                    agent {
+                        label "jenkins-maven"
+                    }
+                    stages('java构建镜像') {
+                        stage('Clone') {
+                            steps{
+                                echo "1.Clone Stage"
+                                git branch: 'master', credentialsId: 'xxxxxxx', url: "xxxxxxx"
+                                script {
+                                    build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
+                                }
+                            }
+                        }
+                        stage('Build') {
+                            steps{
+                                container('maven') {
+                                    echo "3.Build Docker Image Stage"
+                                    sh "mvn clean install -Dmaven.test.skip=true"
+                                    sh "docker build -f epaas-portal/Dockerfile -t hub.gcloud.lab/rongqiyun/epaas:\${build_tag} ."
+                                    sh "docker push hub.gcloud.lab/rongqiyun/epaas:\${build_tag}"
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        stage('部署'){
+            stages('部署到容器云') {
+                stage('check') {
+                    steps{
+                        container('maven') {
+                            script{
+                                if (deploy_app == "true"){
+                                    def tmp = sh (
+                                        returnStdout: true,
+                                        script: "kubectl get deployment -n \${namespace} | grep \${JOB_NAME} | awk '{print \\$1}'"
+                                    )
+                                    //如果是第一次,则使用helm模板创建,创建完后需要去epaas修改pod的配置
+                                    if(tmp.equals('')){
+                                        sh "helm init --client-only"
+                                        sh """helm repo add mychartmuseum http://xxxxxx \\
+                                                           --username myuser \\
+                                                           --password=mypass"""
+                                        sh """helm install --set name=\${JOB_NAME} \\
+                                                           --set namespace=\${namespace} \\
+                                                           --set deployment.image=\${image} \\
+                                                           --set deployment.imagePullSecrets=\${harborProject} \\
+                                                           --name \${namespace}-\${JOB_NAME} \\
+                                                           mychartmuseum/soa-template"""
+                                    }else{
+                                        println "已经存在,替换镜像"
+                                        //epaas中一个pod的容器名称需要带上"-0"来区分
+                                        sh "kubectl set image deployment/\${JOB_NAME} \${JOB_NAME}-0=\${image} -n \${namespace}"
+                                    }
+                                }else{
+                                    println "用户选择不部署代码"
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+

在jenkins x中查看:

4.4 日志

jenkins blue ocean步骤日志:

云效中的日志:

4.5 定时触发

    triggers {
+        cron('H H * * *') //每天
+    }
+

五、其他

5.1 Gitlab触发

pipeline中除了有对于时间的trigger,还支持了gitlab的触发,需要各种配置,不过如果真的对于gitlab的cicd有要求,直接使用gitlab-ci会更好,我们同时也对gitlab进行了runner的配置来支持gitlab的cicd。gitlab的cicd也提供了构建完后即销毁的过程。

六、总结

功能最强大的过程莫过于自己使用pipeline脚本实现,选取最适合自己的,但是对于一个公司来说,如果要求业务方来掌握这些,特别是IT流动性大的时候,既需要重新培训,同个问题又会被问多遍,所以,只能将DevOps实现成一个图形化的东西,方便,简单,相对来说功能还算强大。

DevOps最难的可能都不是以上这些,关键是让用户接受,容器云最初推行时,公司原本传统的很多发版方式都需要进行改变,有些业务方不愿意改,或者有些代码把持久化的东西存到了代码中而不是分布式存储里,甚至有些用户方都不愿意维护老代码,看都不想看然后想上容器,一个公司在做技术架构的时候,过于混乱到最后填坑要么需要耗费太多精力甚至大换血。

最后,DevOps是云原生的必经之路!!!

`,39),$=n("br",null,null,-1),O={href:"https://www.cnblogs.com/w1570631036/p/11524673.html",target:"_blank",rel:"noopener noreferrer"},I=n("br",null,null,-1),B={href:"http://www.wenzhihuai.com/getblogdetail.html?blogid=663",target:"_blank",rel:"noopener noreferrer"},P=n("br",null,null,-1),S={href:"https://gitbook.wenzhihuai.com/devops/devops-ping-tai",target:"_blank",rel:"noopener noreferrer"};function N(J,E){const a=l("ExternalLinkIcon");return p(),c("div",null,[n("h1",u,[d,s(" 3.1 "),n("a",r,[s("DevOps平台.md"),e(a)])]),v,m,g,n("p",null,[s("主要还是基于jenkins里面构建一个自由风格的软件项目,当时参考的是阿里的codepipeline,就是对jenkins封装一层,包括创建job、立即构建、获取构建进度等都进行封装,并将需要的东西进行存库,没有想到码代码的时候,一堆的坑,比如: 1.连续点击立即构建,jenkins是不按顺序返回的,(分布式锁解决) 2.跨域调用,csrf,这个还好,不过容易把jenkins搞的无法登录(注意配置,具体可以点击"),n("a",k,[s("这里"),e(a)]),s(") 3.创建job的时候只支持xml格式,还要转换一下,超级坑(xstream强行转换) 4.docker构建的时候,需要挂载宿主机的docker(想过用远程的,但效率不高) 5.数据库与jenkins的job一致性问题,任务创建失败,批量删除太慢(目前没想好怎么解决) 6.由于使用了数据库,需要检测job是否构建完成,为了自定义参数,我们自写了个通知插件,将构建状态返回到kafka,然后管理平台在进行消息处理。")]),b,n("p",null,[h,s(" 首先要解决的是多个构建同时运行的问题,很久之前就调研过jenkins x,它必须要使用在kubernetes上,由于当时官方文档不全,而且我们的DevOps项目处于初始期,所有没有使用。jenkins的master slave结构就不多说了。jenkins x应该说是个全家桶,包含了helm仓库、nexus仓库、docker registry等,代码是"),n("a",x,[s("jenkins-x-image"),e(a)]),s("。")]),f,q,_,D,j,n("p",null,[C,s(" kubernetes的官方cicd,目前已用于kubernetes的release发版过程,目前也仅仅是与GitHub相结合,gitlab无法使用,全过程可使用yaml文件来创建,跑起来就是类似kubernetes的job一样,用完即销毁,可惜目前比较新,依旧处于alpha版本,无法用于生产。有兴趣可以参考下:"),n("a",w,[s("Knative 初体验:CICD 极速入门 "),e(a)])]),y,n("p",null,[s("文章同步:"),$,s(" 博客园:"),n("a",O,[s("https://www.cnblogs.com/w1570631036/p/11524673.html"),e(a)]),I,s(" 个人网站:"),n("a",B,[s("http://www.wenzhihuai.com/getblogdetail.html?blogid=663"),e(a)]),P,s(" gitbook:"),n("a",S,[s("https://gitbook.wenzhihuai.com/devops/devops-ping-tai"),e(a)])])])}const A=i(o,[["render",N],["__file","devops-ping-tai.html.vue"]]);export{A as default}; diff --git a/assets/devops-ping-tai.html-kDtCSXpk.js b/assets/devops-ping-tai.html-kDtCSXpk.js new file mode 100644 index 00000000..3583863a --- /dev/null +++ b/assets/devops-ping-tai.html-kDtCSXpk.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-580db9be","path":"/devops/devops-ping-tai.html","title":"3.1 DevOps平台.md","lang":"zh-CN","frontmatter":{"description":"3.1 DevOps平台.md DevOps定义(来自维基百科): DevOps(Development和Operations的组合词)是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。 公司技术部目前几百人左右吧,但是整个技术栈还是比较落后的,尤其是DevOps、容器这一块,需要将全线打通,当时进来也主要是负责DevOps这一块的工作,应该说也是没怎么做好,其中也走了不少弯路,下面主要是自己踩过的坑吧。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/devops/devops-ping-tai.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"3.1 DevOps平台.md"}],["meta",{"property":"og:description","content":"3.1 DevOps平台.md DevOps定义(来自维基百科): DevOps(Development和Operations的组合词)是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。 公司技术部目前几百人左右吧,但是整个技术栈还是比较落后的,尤其是DevOps、容器这一块,需要将全线打通,当时进来也主要是负责DevOps这一块的工作,应该说也是没怎么做好,其中也走了不少弯路,下面主要是自己踩过的坑吧。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"3.1 DevOps平台.md\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、自由风格的软件项目","slug":"一、自由风格的软件项目","link":"#一、自由风格的软件项目","children":[]},{"level":2,"title":"二、优化之后的CICD","slug":"二、优化之后的cicd","link":"#二、优化之后的cicd","children":[]},{"level":2,"title":"三、调研期","slug":"三、调研期","link":"#三、调研期","children":[]},{"level":2,"title":"四、产品化后的DevOps平台","slug":"四、产品化后的devops平台","link":"#四、产品化后的devops平台","children":[{"level":3,"title":"4.1 Java代码扫描","slug":"_4-1-java代码扫描","link":"#_4-1-java代码扫描","children":[]},{"level":3,"title":"4.2 Java单元测试","slug":"_4-2-java单元测试","link":"#_4-2-java单元测试","children":[]},{"level":3,"title":"4.3 Java构建并上传镜像","slug":"_4-3-java构建并上传镜像","link":"#_4-3-java构建并上传镜像","children":[]},{"level":3,"title":"4.4 部署到阿里云k8s","slug":"_4-4-部署到阿里云k8s","link":"#_4-4-部署到阿里云k8s","children":[]},{"level":3,"title":"4.5 整体流程","slug":"_4-5-整体流程","link":"#_4-5-整体流程","children":[]},{"level":3,"title":"4.4 日志","slug":"_4-4-日志","link":"#_4-4-日志","children":[]},{"level":3,"title":"4.5 定时触发","slug":"_4-5-定时触发","link":"#_4-5-定时触发","children":[]}]},{"level":2,"title":"五、其他","slug":"五、其他","link":"#五、其他","children":[{"level":3,"title":"5.1 Gitlab触发","slug":"_5-1-gitlab触发","link":"#_5-1-gitlab触发","children":[]}]},{"level":2,"title":"六、总结","slug":"六、总结","link":"#六、总结","children":[]}],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":11.93,"words":3580},"filePathRelative":"devops/devops-ping-tai.md","localizedDate":"2024年1月24日","excerpt":"

3.1 DevOps平台.md

\\n

DevOps定义(来自维基百科): DevOps(Development和Operations的组合词)是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。

\\n

公司技术部目前几百人左右吧,但是整个技术栈还是比较落后的,尤其是DevOps、容器这一块,需要将全线打通,当时进来也主要是负责DevOps这一块的工作,应该说也是没怎么做好,其中也走了不少弯路,下面主要是自己踩过的坑吧。

","autoDesc":true}');export{e as data}; diff --git a/assets/dn1f67-ts10HlrI.png b/assets/dn1f67-ts10HlrI.png new file mode 100644 index 00000000..18a229ee Binary files /dev/null and b/assets/dn1f67-ts10HlrI.png differ diff --git a/assets/eeogjb-u6mCBYaH.png b/assets/eeogjb-u6mCBYaH.png new file mode 100644 index 00000000..9acf503d Binary files /dev/null and b/assets/eeogjb-u6mCBYaH.png differ diff --git a/assets/elastic-spark.html-qWo0Gzw1.js b/assets/elastic-spark.html-qWo0Gzw1.js new file mode 100644 index 00000000..cb1cf21b --- /dev/null +++ b/assets/elastic-spark.html-qWo0Gzw1.js @@ -0,0 +1,31 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as c,c as l,a,d as n,b as t,e as p}from"./app-hbwtiwmf.js";const i={},u=p(`

elastic spark

Hadoop允许Elasticsearch在Spark中以两种方式使用:通过自2.1以来的原生RDD支持,或者通过自2.0以来的Map/Reduce桥接器。从5.0版本开始,elasticsearch-hadoop就支持Spark 2.0。目前spark支持的数据源有:
(1)文件系统:LocalFS、HDFS、Hive、text、parquet、orc、json、csv
(2)数据RDBMS:mysql、oracle、mssql
(3)NOSQL数据库:HBase、ES、Redis
(4)消息对象:Redis

elasticsearch相对hdfs来说,容易搭建、并且有可视化kibana支持,非常方便spark的初学入门,本文主要讲解用elasticsearch-spark的入门。

Spark - Apache Spark
Spark - Apache Spark

一、原生RDD支持

1.1 基础配置

相关库引入:

        <dependency>
+            <groupId>org.elasticsearch</groupId>
+            <artifactId>elasticsearch-spark-30_2.13</artifactId>
+            <version>8.1.3</version>
+        </dependency>
+
`,8),r={href:"https://www.elastic.co/Zephery/en/elasticsearch/hadoop/current/configuration.html",target:"_blank",rel:"noopener noreferrer"},k={href:"https://github.com/elastic/elasticsearch-hadoop/blob/master/mr/src/main/java/org/elasticsearch/hadoop/cfg/ConfigurationOptions.java",target:"_blank",rel:"noopener noreferrer"},d=p(`
public static SparkConf getSparkConf() {
+    SparkConf sparkConf = new SparkConf().setAppName("elasticsearch-spark-demo");
+    sparkConf.set("es.nodes", "host")
+            .set("es.port", "xxxxxx")
+            .set("es.nodes.wan.only", "true")
+            .set("es.net.http.auth.user", "elxxxxastic")
+            .set("es.net.http.auth.pass", "xxxx")
+            .setMaster("local[*]");
+    return sparkConf;
+}
+

1.2 读取es数据

这里用的是kibana提供的sample data里面的索引kibana_sample_data_ecommerce,也可以替换成自己的索引。

public static void main(String[] args) {
+    SparkConf conf = getSparkConf();
+    try (JavaSparkContext jsc = new JavaSparkContext(conf)) {
+
+        JavaPairRDD<String, Map<String, Object>> esRDD =
+                JavaEsSpark.esRDD(jsc, "kibana_sample_data_ecommerce");
+        esRDD.collect().forEach(System.out::println);
+    }
+}
+

esRDD同时也支持query语句esRDD(final JavaSparkContext jsc, final String resource, final String query),一般对es的查询都需要根据时间筛选一下,不过相对于es的官方sdk,并没有那么友好的api,只能直接使用原生的dsl语句。

1.3 写数据

支持序列化对象、json,并且能够使用占位符动态索引写入数据(使用较少),不过多介绍了。

public static void jsonWrite(){
+    String json1 = "{\\"reason\\" : \\"business\\",\\"airport\\" : \\"SFO\\"}";
+    String json2 = "{\\"participants\\" : 5,\\"airport\\" : \\"OTP\\"}";
+    JavaRDD<String> stringRDD = jsc.parallelize(ImmutableList.of(json1, json2));
+    JavaEsSpark.saveJsonToEs(stringRDD, "spark-json");
+}
+

比较常用的读写也就这些,更多可以看下官网相关介绍。

二、Spark Streaming

spark的实时处理,es5.0的时候开始支持,目前

三、Spark SQL

四、Spark Structure Streaming

五、Spark on kubernetes Operator

参考:

`,15),h={href:"https://www.elastic.co/Zephery/en/elasticsearch/hadoop/current/spark.html",target:"_blank",rel:"noopener noreferrer"},m={href:"https://github.com/elastic/elasticsearch-hadoop",target:"_blank",rel:"noopener noreferrer"},v={href:"https://www.jianshu.com/p/996c60f0492a",target:"_blank",rel:"noopener noreferrer"};function g(b,f){const s=o("ExternalLinkIcon");return c(),l("div",null,[u,a("p",null,[n("SparkConf配置,更多详细的请点击"),a("a",r,[n("这里"),t(s)]),n("或者源码"),a("a",k,[n("ConfigurationOptions"),t(s)]),n("。")]),d,a("p",null,[n("1."),a("a",h,[n("Apache Spark support"),t(s)])]),a("p",null,[n("2."),a("a",m,[n("elasticsearch-hadoop"),t(s)])]),a("p",null,[n("3."),a("a",v,[n("使用SparkSQL操作Elasticsearch - Spark入门教程"),t(s)])])])}const _=e(i,[["render",g],["__file","elastic-spark.html.vue"]]);export{_ as default}; diff --git a/assets/elastic-spark.html-yTkDwYPM.js b/assets/elastic-spark.html-yTkDwYPM.js new file mode 100644 index 00000000..76503bf4 --- /dev/null +++ b/assets/elastic-spark.html-yTkDwYPM.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-04e32b44","path":"/bigdata/spark/elastic-spark.html","title":"elastic spark","lang":"zh-CN","frontmatter":{"description":"elastic spark Hadoop允许Elasticsearch在Spark中以两种方式使用:通过自2.1以来的原生RDD支持,或者通过自2.0以来的Map/Reduce桥接器。从5.0版本开始,elasticsearch-hadoop就支持Spark 2.0。目前spark支持的数据源有: (1)文件系统:LocalFS、HDFS、Hive、text、parquet、orc、json、csv (2)数据RDBMS:mysql、oracle、mssql (3)NOSQL数据库:HBase、ES、Redis (4)消息对象:Redis","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/bigdata/spark/elastic-spark.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"elastic spark"}],["meta",{"property":"og:description","content":"elastic spark Hadoop允许Elasticsearch在Spark中以两种方式使用:通过自2.1以来的原生RDD支持,或者通过自2.0以来的Map/Reduce桥接器。从5.0版本开始,elasticsearch-hadoop就支持Spark 2.0。目前spark支持的数据源有: (1)文件系统:LocalFS、HDFS、Hive、text、parquet、orc、json、csv (2)数据RDBMS:mysql、oracle、mssql (3)NOSQL数据库:HBase、ES、Redis (4)消息对象:Redis"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"elastic spark\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、原生RDD支持","slug":"一、原生rdd支持","link":"#一、原生rdd支持","children":[{"level":3,"title":"1.1 基础配置","slug":"_1-1-基础配置","link":"#_1-1-基础配置","children":[]},{"level":3,"title":"1.2 读取es数据","slug":"_1-2-读取es数据","link":"#_1-2-读取es数据","children":[]},{"level":3,"title":"1.3 写数据","slug":"_1-3-写数据","link":"#_1-3-写数据","children":[]}]},{"level":2,"title":"二、Spark Streaming","slug":"二、spark-streaming","link":"#二、spark-streaming","children":[]},{"level":2,"title":"三、Spark SQL","slug":"三、spark-sql","link":"#三、spark-sql","children":[]},{"level":2,"title":"四、Spark Structure Streaming","slug":"四、spark-structure-streaming","link":"#四、spark-structure-streaming","children":[]},{"level":2,"title":"五、Spark on kubernetes Operator","slug":"五、spark-on-kubernetes-operator","link":"#五、spark-on-kubernetes-operator","children":[]}],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":1.71,"words":514},"filePathRelative":"bigdata/spark/elastic-spark.md","localizedDate":"2024年1月25日","excerpt":"

elastic spark

\\n

Hadoop允许Elasticsearch在Spark中以两种方式使用:通过自2.1以来的原生RDD支持,或者通过自2.0以来的Map/Reduce桥接器。从5.0版本开始,elasticsearch-hadoop就支持Spark 2.0。目前spark支持的数据源有:
\\n(1)文件系统:LocalFS、HDFS、Hive、text、parquet、orc、json、csv
\\n(2)数据RDBMS:mysql、oracle、mssql
\\n(3)NOSQL数据库:HBase、ES、Redis
\\n(4)消息对象:Redis

","autoDesc":true}');export{e as data}; diff --git "a/assets/elasticsearch\346\272\220\347\240\201debug.html-G3lK-jt-.js" "b/assets/elasticsearch\346\272\220\347\240\201debug.html-G3lK-jt-.js" new file mode 100644 index 00000000..96fc6f6d --- /dev/null +++ "b/assets/elasticsearch\346\272\220\347\240\201debug.html-G3lK-jt-.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-d73a9aee","path":"/database/elasticsearch/elasticsearch%E6%BA%90%E7%A0%81debug.html","title":"【elasticsearch】源码debug","lang":"zh-CN","frontmatter":{"description":"【elasticsearch】源码debug 一、下载源代码 直接用idea下载代码https://github.com/elastic/elasticsearch.git 切换到特定版本的分支:比如7.17,之后idea会自己加上Run/Debug Elasitcsearch的,配置可以不用改,默认就好 二、修改设置(可选)","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/elasticsearch/elasticsearch%E6%BA%90%E7%A0%81debug.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"【elasticsearch】源码debug"}],["meta",{"property":"og:description","content":"【elasticsearch】源码debug 一、下载源代码 直接用idea下载代码https://github.com/elastic/elasticsearch.git 切换到特定版本的分支:比如7.17,之后idea会自己加上Run/Debug Elasitcsearch的,配置可以不用改,默认就好 二、修改设置(可选)"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:image","content":"http://www.wenzhihuai.com/"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T13:13:41.000Z"}],["meta",{"name":"twitter:card","content":"summary_large_image"}],["meta",{"name":"twitter:image:alt","content":"【elasticsearch】源码debug"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T13:13:41.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"【elasticsearch】源码debug\\",\\"image\\":[\\"http://www.wenzhihuai.com/\\"],\\"dateModified\\":\\"2024-01-25T13:13:41.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706186538000,"updatedTime":1706188421000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.5,"words":151},"filePathRelative":"database/elasticsearch/elasticsearch源码debug.md","localizedDate":"2024年1月25日","excerpt":"

【elasticsearch】源码debug

\\n

一、下载源代码

\\n

直接用idea下载代码https://github.com/elastic/elasticsearch.git
\\n

\\n

切换到特定版本的分支:比如7.17,之后idea会自己加上Run/Debug Elasitcsearch的,配置可以不用改,默认就好
\\n

\\n

二、修改设置(可选)

","autoDesc":true}');export{e as data}; diff --git "a/assets/elasticsearch\346\272\220\347\240\201debug.html-LzC5N4Nu.js" "b/assets/elasticsearch\346\272\220\347\240\201debug.html-LzC5N4Nu.js" new file mode 100644 index 00000000..4f54603d --- /dev/null +++ "b/assets/elasticsearch\346\272\220\347\240\201debug.html-LzC5N4Nu.js" @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{r,o as c,c as i,a as e,d as a,b as n,e as o}from"./app-hbwtiwmf.js";const d="/assets/755525-20220124160719006-851383635-wz6ZuPyA.png",l="/assets/755525-20220124160709513-361605195-8g-Fyjbx.png",h="/assets/755525-20220124160657219-1269826381-TCdcRh3a.png",p={},_=e("h1",{id:"【elasticsearch】源码debug",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#【elasticsearch】源码debug","aria-hidden":"true"},"#"),a(" 【elasticsearch】源码debug")],-1),u=e("h1",{id:"一、下载源代码",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#一、下载源代码","aria-hidden":"true"},"#"),a(" 一、下载源代码")],-1),g={href:"https://github.com/elastic/elasticsearch.git",target:"_blank",rel:"noopener noreferrer"},m=e("br",null,null,-1),b=e("img",{src:d,alt:"image"},null,-1),f=o('

切换到特定版本的分支:比如7.17,之后idea会自己加上Run/Debug Elasitcsearch的,配置可以不用改,默认就好
image

二、修改设置(可选)

为了方便, 在 gradle/run.gradle 中关闭 Auth 认证:

setting 'xpack.security.enabled', 'false'

或者使用其中的用户名密码:

user username: 'elastic-admin', password: 'elastic-password', role: 'superuser'

三、启动

先启动上面的 remote debug, 然后用 gradlew 启动项目:

./gradlew :run --debug-jvm
打开浏览器http://localhost:9200即可看到es相关信息了
image

',9);function x(k,w){const s=r("ExternalLinkIcon");return c(),i("div",null,[_,u,e("p",null,[a("直接用idea下载代码"),e("a",g,[a("https://github.com/elastic/elasticsearch.git"),n(s)]),m,b]),f])}const N=t(p,[["render",x],["__file","elasticsearch源码debug.html.vue"]]);export{N as default}; diff --git "a/assets/gap\351\224\201.html-FsDBg4Au.js" "b/assets/gap\351\224\201.html-FsDBg4Au.js" new file mode 100644 index 00000000..e514da31 --- /dev/null +++ "b/assets/gap\351\224\201.html-FsDBg4Au.js" @@ -0,0 +1 @@ +import{_ as a}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c as o,a as e,d as r}from"./app-hbwtiwmf.js";const c={},s=e("h1",{id:"gap锁",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#gap锁","aria-hidden":"true"},"#"),r(" gap锁")],-1),_=[s];function n(d,i){return t(),o("div",null,_)}const p=a(c,[["render",n],["__file","gap锁.html.vue"]]);export{p as default}; diff --git "a/assets/gap\351\224\201.html-i4faTCf2.js" "b/assets/gap\351\224\201.html-i4faTCf2.js" new file mode 100644 index 00000000..463eedc1 --- /dev/null +++ "b/assets/gap\351\224\201.html-i4faTCf2.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-3192e5a0","path":"/database/mysql/gap%E9%94%81.html","title":"gap锁","lang":"zh-CN","frontmatter":{"description":"gap锁","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/mysql/gap%E9%94%81.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"gap锁"}],["meta",{"property":"og:description","content":"gap锁"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"gap锁\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.01,"words":2},"filePathRelative":"database/mysql/gap锁.md","localizedDate":"2024年1月24日","excerpt":"

gap锁

\\n","autoDesc":true}');export{e as data}; diff --git a/assets/giscus-NkhROb6B.js b/assets/giscus-NkhROb6B.js new file mode 100644 index 00000000..28de2fa3 --- /dev/null +++ b/assets/giscus-NkhROb6B.js @@ -0,0 +1,66 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const H=globalThis,q=H.ShadowRoot&&(H.ShadyCSS===void 0||H.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),J=new WeakMap;let ot=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(q&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=J.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&J.set(e,t))}return t}toString(){return this.cssText}};const ut=i=>new ot(typeof i=="string"?i:i+"",void 0,K),$t=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,r,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new ot(e,i,K)},_t=(i,t)=>{if(q)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),r=H.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}},F=q?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return ut(e)})(i):i;/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const{is:gt,defineProperty:ft,getOwnPropertyDescriptor:mt,getOwnPropertyNames:At,getOwnPropertySymbols:yt,getPrototypeOf:St}=Object,A=globalThis,Q=A.trustedTypes,vt=Q?Q.emptyScript:"",z=A.reactiveElementPolyfillSupport,U=(i,t)=>i,L={toAttribute(i,t){switch(t){case Boolean:i=i?vt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},Y=(i,t)=>!gt(i,t),Z={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:Y};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),A.litPropertyMetadata??(A.litPropertyMetadata=new WeakMap);class E extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Z){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&ft(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:o}=mt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return r==null?void 0:r.call(this)},set(n){const a=r==null?void 0:r.call(this);o.call(this,n),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Z}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=St(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const e=this.properties,s=[...At(e),...yt(e)];for(const r of s)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const r of s)e.unshift(F(r))}else t!==void 0&&e.push(F(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$E_??(this._$E_=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _t(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$E_)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){var o;const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){const n=(((o=s.converter)==null?void 0:o.toAttribute)!==void 0?s.converter:L).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){var o;const s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:L;this._$Em=r,this[r]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??Y)(this[t],e))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$ET??(this._$ET=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[o,n]of r)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$E_)==null||s.forEach(r=>{var o;return(o=r.hostUpdate)==null?void 0:o.call(r)}),this.update(e)):this._$Ej()}catch(r){throw t=!1,this._$Ej(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(s=>{var r;return(r=s.hostUpdated)==null?void 0:r.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ej(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$ET&&(this._$ET=this._$ET.forEach(e=>this._$EO(e,this[e]))),this._$Ej()}updated(t){}firstUpdated(t){}}E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[U("elementProperties")]=new Map,E[U("finalized")]=new Map,z==null||z({ReactiveElement:E}),(A.reactiveElementVersions??(A.reactiveElementVersions=[])).push("2.0.3");/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const P=globalThis,k=P.trustedTypes,X=k?k.createPolicy("lit-html",{createHTML:i=>i}):void 0,ht="$lit$",m=`lit$${(Math.random()+"").slice(9)}$`,at="?"+m,Et=`<${at}>`,v=document,N=()=>v.createComment(""),R=i=>i===null||typeof i!="object"&&typeof i!="function",ct=Array.isArray,bt=i=>ct(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",B=`[ +\f\r]`,w=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,tt=/-->/g,et=/>/g,y=RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),st=/'/g,it=/"/g,lt=/^(?:script|style|textarea|title)$/i,Ct=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),wt=Ct(1),b=Symbol.for("lit-noChange"),l=Symbol.for("lit-nothing"),rt=new WeakMap,S=v.createTreeWalker(v,129);function dt(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return X!==void 0?X.createHTML(t):t}const Ut=(i,t)=>{const e=i.length-1,s=[];let r,o=t===2?"":"",n=w;for(let a=0;a"?(n=r??w,c=-1):u[1]===void 0?c=-2:(c=n.lastIndex-u[2].length,d=u[1],n=u[3]===void 0?y:u[3]==='"'?it:st):n===it||n===st?n=y:n===tt||n===et?n=w:(n=y,r=void 0);const f=n===y&&i[a+1].startsWith("/>")?" ":"";o+=n===w?h+Et:c>=0?(s.push(d),h.slice(0,c)+ht+h.slice(c)+m+f):h+m+(c===-2?a:f)}return[dt(i,o+(i[e]||"")+(t===2?"":"")),s]};class I{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let o=0,n=0;const a=t.length-1,h=this.parts,[d,u]=Ut(t,e);if(this.el=I.createElement(d,s),S.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=S.nextNode())!==null&&h.length0){r.textContent=k?k.emptyScript:"";for(let f=0;f2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=l}_$AI(t,e=this,s,r){const o=this.strings;let n=!1;if(o===void 0)t=C(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const a=t;let h,d;for(t=o[0],h=0;h{const s=(e==null?void 0:e.renderBefore)??t;let r=s._$litPart$;if(r===void 0){const o=(e==null?void 0:e.renderBefore)??null;s._$litPart$=r=new M(t.insertBefore(N(),o),o,void 0,e??{})}return r._$AI(i),r};/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */let O=class extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=It(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return b}};var nt;O._$litElement$=!0,O.finalized=!0,(nt=globalThis.litElementHydrateSupport)==null||nt.call(globalThis,{LitElement:O});const W=globalThis.litElementPolyfillSupport;W==null||W({LitElement:O});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.3");/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Mt=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const xt={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:Y},Ht=(i=xt,t,e)=>{const{kind:s,metadata:r}=e;let o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),o.set(e.name,i),s==="accessor"){const{name:n}=e;return{set(a){const h=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,h,i)},init(a){return a!==void 0&&this.C(n,void 0,i),a}}}if(s==="setter"){const{name:n}=e;return function(a){const h=this[n];t.call(this,a),this.requestUpdate(n,h,i)}}throw Error("Unsupported decorator location: "+s)};function _(i){return(t,e)=>typeof e=="object"?Ht(i,t,e):((s,r,o)=>{const n=r.hasOwnProperty(o);return r.constructor.createProperty(o,n?{...s,wrapped:!0}:s),n?Object.getOwnPropertyDescriptor(r,o):void 0})(i,t,e)}/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Lt=i=>i.strings===void 0;/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const kt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Gt=i=>(...t)=>({_$litDirective$:i,values:t});let Dt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const T=(i,t)=>{var s;const e=i._$AN;if(e===void 0)return!1;for(const r of e)(s=r._$AO)==null||s.call(r,t,!1),T(r,t);return!0},G=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},pt=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),jt(t)}};function zt(i){this._$AN!==void 0?(G(this),this._$AM=i,pt(this)):this._$AM=i}function Bt(i,t=!1,e=0){const s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let o=e;o{i.type==kt.CHILD&&(i._$AP??(i._$AP=Bt),i._$AQ??(i._$AQ=zt))};class Wt extends Dt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),pt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var s,r;t!==this.isConnected&&(this.isConnected=t,t?(s=this.reconnected)==null||s.call(this):(r=this.disconnected)==null||r.call(this)),e&&(T(this,t),G(this))}setValue(t){if(Lt(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Vt=()=>new qt;class qt{}const V=new WeakMap,Kt=Gt(class extends Wt{render(i){return l}update(i,[t]){var s;const e=t!==this.G;return e&&this.G!==void 0&&this.ot(void 0),(e||this.rt!==this.lt)&&(this.G=t,this.ct=(s=i.options)==null?void 0:s.host,this.ot(this.lt=i.element)),l}ot(i){if(typeof this.G=="function"){const t=this.ct??globalThis;let e=V.get(t);e===void 0&&(e=new WeakMap,V.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ct,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ct,i)}else this.G.value=i}get rt(){var i,t;return typeof this.G=="function"?(i=V.get(this.ct??globalThis))==null?void 0:i.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});var Yt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,$=(i,t,e,s)=>{for(var r=s>1?void 0:s?Jt(t,e):t,o=i.length-1,n;o>=0;o--)(n=i[o])&&(r=(s?n(t,e,r):n(r))||r);return s&&r&&Yt(t,e,r),r};function Ft(i){return customElements.get(i)?t=>t:Mt(i)}let p=class extends O{constructor(){super(),this.GISCUS_SESSION_KEY="giscus-session",this.GISCUS_DEFAULT_HOST="https://giscus.app",this.ERROR_SUGGESTION="Please consider reporting this error at https://github.com/giscus/giscus/issues/new.",this.__session="",this._iframeRef=Vt(),this.messageEventHandler=this.handleMessageEvent.bind(this),this.hasLoaded=!1,this.host=this.GISCUS_DEFAULT_HOST,this.strict="0",this.reactionsEnabled="1",this.emitMetadata="0",this.inputPosition="bottom",this.theme="light",this.lang="en",this.loading="eager",this.setupSession(),window.addEventListener("message",this.messageEventHandler)}get iframeRef(){var i;return(i=this._iframeRef)==null?void 0:i.value}get _host(){try{return new URL(this.host),this.host}catch{return this.GISCUS_DEFAULT_HOST}}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.messageEventHandler)}_formatError(i){return`[giscus] An error occurred. Error message: "${i}".`}setupSession(){const i=location.href,t=new URL(i),e=localStorage.getItem(this.GISCUS_SESSION_KEY),s=t.searchParams.get("giscus")??"";if(this.__session="",s){localStorage.setItem(this.GISCUS_SESSION_KEY,JSON.stringify(s)),this.__session=s,t.searchParams.delete("giscus"),t.hash="",history.replaceState(void 0,document.title,t.toString());return}if(e)try{this.__session=JSON.parse(e)}catch(r){localStorage.removeItem(this.GISCUS_SESSION_KEY),console.warn(`${this._formatError(r==null?void 0:r.message)} Session has been cleared.`)}}signOut(){localStorage.removeItem(this.GISCUS_SESSION_KEY),this.__session="",this.update(new Map)}handleMessageEvent(i){if(i.origin!==this._host)return;const{data:t}=i;if(!(typeof t=="object"&&t.giscus))return;if(this.iframeRef&&t.giscus.resizeHeight&&(this.iframeRef.style.height=`${t.giscus.resizeHeight}px`),t.giscus.signOut){console.info("[giscus] User has logged out. Session has been cleared."),this.signOut();return}if(!t.giscus.error)return;const e=t.giscus.error;if(e.includes("Bad credentials")||e.includes("Invalid state value")||e.includes("State has expired")){if(localStorage.getItem(this.GISCUS_SESSION_KEY)!==null){console.warn(`${this._formatError(e)} Session has been cleared.`),this.signOut();return}console.error(`${this._formatError(e)} No session is stored initially. ${this.ERROR_SUGGESTION}`)}if(e.includes("Discussion not found")){console.warn(`[giscus] ${e}. A new discussion will be created if a comment/reaction is submitted.`);return}console.error(`${this._formatError(e)} ${this.ERROR_SUGGESTION}`)}sendMessage(i){var t;!((t=this.iframeRef)!=null&&t.contentWindow)||!this.hasLoaded||this.iframeRef.contentWindow.postMessage({giscus:i},this._host)}updateConfig(){const i={setConfig:{repo:this.repo,repoId:this.repoId,category:this.category,categoryId:this.categoryId,term:this.getTerm(),number:+this.getNumber(),strict:this.strict==="1",reactionsEnabled:this.reactionsEnabled==="1",emitMetadata:this.emitMetadata==="1",inputPosition:this.inputPosition,theme:this.theme,lang:this.lang}};this.sendMessage(i)}firstUpdated(){var i;(i=this.iframeRef)==null||i.addEventListener("load",()=>{var t;(t=this.iframeRef)==null||t.classList.remove("loading"),this.hasLoaded=!0,this.updateConfig()})}requestUpdate(i,t,e){if(!this.hasUpdated||i==="host"){super.requestUpdate(i,t,e);return}this.updateConfig()}getMetaContent(i,t=!1){const e=t?`meta[property='og:${i}'],`:"",s=document.querySelector(e+`meta[name='${i}']`);return s?s.content:""}_getCleanedUrl(){const i=new URL(location.href);return i.searchParams.delete("giscus"),i.hash="",i}getTerm(){switch(this.mapping){case"url":return this._getCleanedUrl().toString();case"title":return document.title;case"og:title":return this.getMetaContent("title",!0);case"specific":return this.term??"";case"number":return"";case"pathname":default:return location.pathname.length<2?"index":location.pathname.substring(1).replace(/\.\w+$/,"")}}getNumber(){return this.mapping==="number"?this.term??"":""}getIframeSrc(){const i=this._getCleanedUrl().toString(),t=`${i}${this.id?"#"+this.id:""}`,e=this.getMetaContent("description",!0),s=this.getMetaContent("giscus:backlink")||i,r={origin:t,session:this.__session,repo:this.repo,repoId:this.repoId??"",category:this.category??"",categoryId:this.categoryId??"",term:this.getTerm(),number:this.getNumber(),strict:this.strict,reactionsEnabled:this.reactionsEnabled,emitMetadata:this.emitMetadata,inputPosition:this.inputPosition,theme:this.theme,description:e,backLink:s},o=this._host,n=this.lang?`/${this.lang}`:"",a=new URLSearchParams(r);return`${o}${n}/widget?${a.toString()}`}render(){return wt` + + `}};p.styles=$t` + :host, + iframe { + width: 100%; + border: none; + min-height: 150px; + color-scheme: light dark; + } + + iframe.loading { + opacity: 0; + } + `;$([_({reflect:!0})],p.prototype,"host",2);$([_({reflect:!0})],p.prototype,"repo",2);$([_({reflect:!0})],p.prototype,"repoId",2);$([_({reflect:!0})],p.prototype,"category",2);$([_({reflect:!0})],p.prototype,"categoryId",2);$([_({reflect:!0})],p.prototype,"mapping",2);$([_({reflect:!0})],p.prototype,"term",2);$([_({reflect:!0})],p.prototype,"strict",2);$([_({reflect:!0})],p.prototype,"reactionsEnabled",2);$([_({reflect:!0})],p.prototype,"emitMetadata",2);$([_({reflect:!0})],p.prototype,"inputPosition",2);$([_({reflect:!0})],p.prototype,"theme",2);$([_({reflect:!0})],p.prototype,"lang",2);$([_({reflect:!0})],p.prototype,"loading",2);p=$([Ft("giscus-widget")],p);export{p as GiscusWidget}; diff --git a/assets/gitlab-ci.html-HyFv5Ls3.js b/assets/gitlab-ci.html-HyFv5Ls3.js new file mode 100644 index 00000000..6397a4ab --- /dev/null +++ b/assets/gitlab-ci.html-HyFv5Ls3.js @@ -0,0 +1 @@ +const t=JSON.parse('{"key":"v-06d5cd4c","path":"/devops/gitlab-ci.html","title":"Git","lang":"zh-CN","frontmatter":{"description":"Git","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/devops/gitlab-ci.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"Git"}],["meta",{"property":"og:description","content":"Git"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"Git\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":1},"filePathRelative":"devops/gitlab-ci.md","localizedDate":"2024年1月24日","excerpt":"

Git

\\n","autoDesc":true}');export{t as data}; diff --git a/assets/gitlab-ci.html-V0G7osrF.js b/assets/gitlab-ci.html-V0G7osrF.js new file mode 100644 index 00000000..80f13b97 --- /dev/null +++ b/assets/gitlab-ci.html-V0G7osrF.js @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as a,c,a as e,d as o}from"./app-hbwtiwmf.js";const r={},i=e("h1",{id:"git",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#git","aria-hidden":"true"},"#"),o(" Git")],-1),s=[i];function n(_,d){return a(),c("div",null,s)}const f=t(r,[["render",n],["__file","gitlab-ci.html.vue"]]);export{f as default}; diff --git a/assets/home.html-H-V88rlY.js b/assets/home.html-H-V88rlY.js new file mode 100644 index 00000000..25c920e0 --- /dev/null +++ b/assets/home.html-H-V88rlY.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-79fdd481","path":"/home.html","title":"","lang":"zh-CN","frontmatter":{"description":"一、Java 1.1 一次jvm调优过程.md 1.2 JVM调优参数.md 1.3 serverlog.md 1.4 【elasticsearch】搜索过程详解 1.5 基于kubernetes的分布式限流 二、大数据 3.1 elastic-spark.md 三、个人网站 3.1 历史与架构.md 3.2 Lucene的使用.md 3.3 定时任务.md 3.4 日志系统.md 3.5 小集群部署.md 3.6 数据库备份.md 3.7 那些牛逼的插件.md 3.8 基于贝叶斯的情感分析.md 3.9 网站性能优化.md 四、DevOps 4.1 DevOps平台.md 4.2 jenkins-x 4.3 tekton 4.4 Git 五、Kubernetes 六、云原生 七、redis 7.1 redis缓存.md 八、mysql 8.1 mysql缓存.md 面试 算法 jvm kafka mysql kubernetes 生活 3017.md 3018.md 3019.md","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/home.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"一、Java 1.1 一次jvm调优过程.md 1.2 JVM调优参数.md 1.3 serverlog.md 1.4 【elasticsearch】搜索过程详解 1.5 基于kubernetes的分布式限流 二、大数据 3.1 elastic-spark.md 三、个人网站 3.1 历史与架构.md 3.2 Lucene的使用.md 3.3 定时任务.md 3.4 日志系统.md 3.5 小集群部署.md 3.6 数据库备份.md 3.7 那些牛逼的插件.md 3.8 基于贝叶斯的情感分析.md 3.9 网站性能优化.md 四、DevOps 4.1 DevOps平台.md 4.2 jenkins-x 4.3 tekton 4.4 Git 五、Kubernetes 六、云原生 七、redis 7.1 redis缓存.md 八、mysql 8.1 mysql缓存.md 面试 算法 jvm kafka mysql kubernetes 生活 3017.md 3018.md 3019.md"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:46:04.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:46:04.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:46:04.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706084611000,"updatedTime":1706183164000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":4}]},"readingTime":{"minutes":1.02,"words":305},"filePathRelative":"home.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/home.html-UbXL2gcY.js b/assets/home.html-UbXL2gcY.js new file mode 100644 index 00000000..bd682afa --- /dev/null +++ b/assets/home.html-UbXL2gcY.js @@ -0,0 +1 @@ +import{_ as n}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as i,o as E,c as o,a as l,b as t,w as u,d as a}from"./app-hbwtiwmf.js";const d={};function s(m,B){const e=i("RouterLink");return E(),o("div",null,[l("ul",null,[l("li",null,[l("p",null,[t(e,{to:"/java/"},{default:u(()=>[a("一、Java")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html"},{default:u(()=>[a("1.1 一次jvm调优过程.md")]),_:1})]),l("li",null,[t(e,{to:"/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html"},{default:u(()=>[a("1.2 JVM调优参数.md")]),_:1})]),l("li",null,[t(e,{to:"/java/serverlog.html"},{default:u(()=>[a("1.3 serverlog.md")]),_:1})]),l("li",null,[t(e,{to:"/database/elasticsearch/es8.0%E7%BB%83%E4%B9%A0.html"},{default:u(()=>[a("1.4 【elasticsearch】搜索过程详解")]),_:1})]),l("li",null,[t(e,{to:"/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html"},{default:u(()=>[a("1.5 基于kubernetes的分布式限流")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/bigdata/"},{default:u(()=>[a("二、大数据")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/bigdata/spark/elastic-spark.html"},{default:u(()=>[a("3.1 elastic-spark.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/personalWebsite/"},{default:u(()=>[a("三、个人网站")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html"},{default:u(()=>[a("3.1 历史与架构.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html"},{default:u(()=>[a("3.2 Lucene的使用.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html"},{default:u(()=>[a("3.3 定时任务.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html"},{default:u(()=>[a("3.4 日志系统.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html"},{default:u(()=>[a("3.5 小集群部署.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html"},{default:u(()=>[a("3.6 数据库备份.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html"},{default:u(()=>[a("3.7 那些牛逼的插件.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html"},{default:u(()=>[a("3.8 基于贝叶斯的情感分析.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html"},{default:u(()=>[a("3.9 网站性能优化.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/devops/"},{default:u(()=>[a("四、DevOps")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/devops/devops-ping-tai.html"},{default:u(()=>[a("4.1 DevOps平台.md")]),_:1})]),l("li",null,[t(e,{to:"/devops/jenkins-x.html"},{default:u(()=>[a("4.2 jenkins-x")]),_:1})]),l("li",null,[t(e,{to:"/devops/tekton.html"},{default:u(()=>[a("4.3 tekton")]),_:1})]),l("li",null,[t(e,{to:"/devops/gitlab-ci.html"},{default:u(()=>[a("4.4 Git")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/kubernetes/"},{default:u(()=>[a("五、Kubernetes")]),_:1})])]),l("li",null,[l("p",null,[t(e,{to:"/cloudnative/"},{default:u(()=>[a("六、云原生")]),_:1})])]),l("li",null,[l("p",null,[t(e,{to:"/redis/"},{default:u(()=>[a("七、redis")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/redis/redis%E7%BC%93%E5%AD%98.html"},{default:u(()=>[a("7.1 redis缓存.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/database/mysql/"},{default:u(()=>[a("八、mysql")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html"},{default:u(()=>[a("8.1 mysql缓存.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/docs/interview/"},{default:u(()=>[a("面试")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/docs/interview/%E7%AE%97%E6%B3%95.html"},{default:u(()=>[a("算法")]),_:1})]),l("li",null,[t(e,{to:"/interview/jvm.html"},{default:u(()=>[a("jvm")]),_:1})]),l("li",null,[t(e,{to:"/interview/kafka.html"},{default:u(()=>[a("kafka")]),_:1})]),l("li",null,[t(e,{to:"/interview/mysql.html"},{default:u(()=>[a("mysql")]),_:1})]),l("li",null,[t(e,{to:"/interview/kubernetes.html"},{default:u(()=>[a("kubernetes")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/life/"},{default:u(()=>[a("生活")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/life/2017.html"},{default:u(()=>[a("3017.md")]),_:1})]),l("li",null,[t(e,{to:"/life/2018.html"},{default:u(()=>[a("3018.md")]),_:1})]),l("li",null,[t(e,{to:"/life/2019.html"},{default:u(()=>[a("3019.md")]),_:1})])])])])])}const _=n(d,[["render",s],["__file","home.html.vue"]]);export{_ as default}; diff --git a/assets/icon/apple-icon-152.png b/assets/icon/apple-icon-152.png new file mode 100644 index 00000000..f53c6c55 Binary files /dev/null and b/assets/icon/apple-icon-152.png differ diff --git a/assets/icon/chrome-192.png b/assets/icon/chrome-192.png new file mode 100644 index 00000000..57096280 Binary files /dev/null and b/assets/icon/chrome-192.png differ diff --git a/assets/icon/chrome-512.png b/assets/icon/chrome-512.png new file mode 100644 index 00000000..2db62c29 Binary files /dev/null and b/assets/icon/chrome-512.png differ diff --git a/assets/icon/chrome-mask-192.png b/assets/icon/chrome-mask-192.png new file mode 100644 index 00000000..77c39a2a Binary files /dev/null and b/assets/icon/chrome-mask-192.png differ diff --git a/assets/icon/chrome-mask-512.png b/assets/icon/chrome-mask-512.png new file mode 100644 index 00000000..b8349f4e Binary files /dev/null and b/assets/icon/chrome-mask-512.png differ diff --git a/assets/icon/guide-maskable.png b/assets/icon/guide-maskable.png new file mode 100644 index 00000000..230798a3 Binary files /dev/null and b/assets/icon/guide-maskable.png differ diff --git a/assets/icon/guide-monochrome.png b/assets/icon/guide-monochrome.png new file mode 100644 index 00000000..e12403e2 Binary files /dev/null and b/assets/icon/guide-monochrome.png differ diff --git a/assets/icon/ms-icon-144.png b/assets/icon/ms-icon-144.png new file mode 100644 index 00000000..681cde6f Binary files /dev/null and b/assets/icon/ms-icon-144.png differ diff --git a/assets/img-kuzmmtyE.png b/assets/img-kuzmmtyE.png new file mode 100644 index 00000000..fccce293 Binary files /dev/null and b/assets/img-kuzmmtyE.png differ diff --git a/assets/img_1-mEcVW6nR.png b/assets/img_1-mEcVW6nR.png new file mode 100644 index 00000000..64cf87d5 Binary files /dev/null and b/assets/img_1-mEcVW6nR.png differ diff --git a/assets/index.html-2YbHRIsG.js b/assets/index.html-2YbHRIsG.js new file mode 100644 index 00000000..8ff39230 --- /dev/null +++ b/assets/index.html-2YbHRIsG.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-02bc92be","path":"/bigdata/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/bigdata/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"bigdata/README.md","localizedDate":"2024年1月25日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-2xQqwR-V.js b/assets/index.html-2xQqwR-V.js new file mode 100644 index 00000000..3e89b994 --- /dev/null +++ b/assets/index.html-2xQqwR-V.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-2e25198a","path":"/database/","title":"","lang":"zh-CN","frontmatter":{"description":"八、mysql 8.1 mysql缓存.md","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"八、mysql 8.1 mysql缓存.md"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.05,"words":15},"filePathRelative":"database/README.md","localizedDate":"2024年1月25日","excerpt":"\\n","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-3xocHf-h.js b/assets/index.html-3xocHf-h.js new file mode 100644 index 00000000..cdb06db0 --- /dev/null +++ b/assets/index.html-3xocHf-h.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-14e6315a","path":"/life/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/life/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"life/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-48vkkelG.js b/assets/index.html-48vkkelG.js new file mode 100644 index 00000000..d5872d8a --- /dev/null +++ b/assets/index.html-48vkkelG.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-744d024e","path":"/tag/","title":"标签","lang":"zh-CN","frontmatter":{"title":"标签","dir":{"index":false},"index":false,"feed":false,"sitemap":false,"blog":{"type":"category","key":"tag"},"layout":"BlogCategory","description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/tag/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"标签"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"标签\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":0},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-5Ud_mAI1.js b/assets/index.html-5Ud_mAI1.js new file mode 100644 index 00000000..2ac1e94d --- /dev/null +++ b/assets/index.html-5Ud_mAI1.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-dc384366","path":"/redis/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/redis/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"redis/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-6v5-_UpR.js b/assets/index.html-6v5-_UpR.js new file mode 100644 index 00000000..b640866b --- /dev/null +++ b/assets/index.html-6v5-_UpR.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-525c5e4d","path":"/personalWebsite/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/personalWebsite/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"personalWebsite/README.md","localizedDate":"2024年1月25日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-8ckAhyww.js b/assets/index.html-8ckAhyww.js new file mode 100644 index 00000000..f38606bf --- /dev/null +++ b/assets/index.html-8ckAhyww.js @@ -0,0 +1 @@ +import{_ as n}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as a,o as c,c as l,a as e,d as o,b as t}from"./app-hbwtiwmf.js";const s={},d=e("h1",{id:"三、devops",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#三、devops","aria-hidden":"true"},"#"),o(" 三、DevOps")],-1),i={href:"https://github.com/Zephery/book/tree/64e9606b37cc2743260cbab2f6d7a4f3667c1aa9/devops/DevOps%E5%B9%B3%E5%8F%B0.md",target:"_blank",rel:"noopener noreferrer"},h={href:"https://github.com/Zephery/book/tree/64e9606b37cc2743260cbab2f6d7a4f3667c1aa9/devops/gitlab-ci.md",target:"_blank",rel:"noopener noreferrer"},p={href:"https://github.com/Zephery/book/tree/64e9606b37cc2743260cbab2f6d7a4f3667c1aa9/devops/jenkins-x.md",target:"_blank",rel:"noopener noreferrer"},b={href:"https://github.com/Zephery/book/tree/64e9606b37cc2743260cbab2f6d7a4f3667c1aa9/devops/tekton.md",target:"_blank",rel:"noopener noreferrer"};function _(f,m){const r=a("ExternalLinkIcon");return c(),l("div",null,[d,e("ul",null,[e("li",null,[o("DevOps "),e("ul",null,[e("li",null,[e("a",i,[o("DevOps平台"),t(r)])]),e("li",null,[e("a",h,[o("Gitlab-ci"),t(r)])]),e("li",null,[e("a",p,[o("jenkins-x.md"),t(r)])]),e("li",null,[e("a",b,[o("tekton"),t(r)])])])])])])}const v=n(s,[["render",_],["__file","index.html.vue"]]);export{v as default}; diff --git a/assets/index.html-94q5B7mi.js b/assets/index.html-94q5B7mi.js new file mode 100644 index 00000000..48139630 --- /dev/null +++ b/assets/index.html-94q5B7mi.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o,c as t,a as c}from"./app-hbwtiwmf.js";const n={},_=c("p",null,"jfaowejfoewj",-1),s=[_];function r(a,l){return o(),t("div",null,s)}const d=e(n,[["render",r],["__file","index.html.vue"]]);export{d as default}; diff --git a/assets/index.html-C3hdABea.js b/assets/index.html-C3hdABea.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-C3hdABea.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-Dich0-0L.js b/assets/index.html-Dich0-0L.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-Dich0-0L.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-EPjOVUzU.js b/assets/index.html-EPjOVUzU.js new file mode 100644 index 00000000..7bb9b730 --- /dev/null +++ b/assets/index.html-EPjOVUzU.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-21ba2ec8","path":"/database/mysql/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/mysql/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"database/mysql/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-GFsHk5I4.js b/assets/index.html-GFsHk5I4.js new file mode 100644 index 00000000..fc8af7c6 --- /dev/null +++ b/assets/index.html-GFsHk5I4.js @@ -0,0 +1 @@ +import{_ as o}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as t,o as n,c,b as r}from"./app-hbwtiwmf.js";const a={};function _(s,l){const e=t("AutoCatalog");return n(),c("div",null,[r(e)])}const i=o(a,[["render",_],["__file","index.html.vue"]]);export{i as default}; diff --git a/assets/index.html-HlLxoAqK.js b/assets/index.html-HlLxoAqK.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-HlLxoAqK.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-HoKSYW3I.js b/assets/index.html-HoKSYW3I.js new file mode 100644 index 00000000..63f7890f --- /dev/null +++ b/assets/index.html-HoKSYW3I.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-50cb12f2","path":"/donate/","title":"微信支付","lang":"zh-CN","frontmatter":{"description":"微信支付 微信支付","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/donate/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"微信支付"}],["meta",{"property":"og:description","content":"微信支付 微信支付"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"微信支付\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.03,"words":9},"filePathRelative":"donate/README.md","localizedDate":"2024年1月25日","excerpt":"

微信支付

\\n
微信支付
\\n","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-IZIHDPXq.js b/assets/index.html-IZIHDPXq.js new file mode 100644 index 00000000..736456b8 --- /dev/null +++ b/assets/index.html-IZIHDPXq.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-e52c881c","path":"/article/","title":"文章","lang":"zh-CN","frontmatter":{"title":"文章","dir":{"index":false},"index":false,"feed":false,"sitemap":false,"blog":{"type":"type","key":"article"},"layout":"BlogType","description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/article/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"文章"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"文章\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":0},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-IkrxIkND.js b/assets/index.html-IkrxIkND.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-IkrxIkND.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-K26-GfV4.js b/assets/index.html-K26-GfV4.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-K26-GfV4.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-KA0_6BkE.js b/assets/index.html-KA0_6BkE.js new file mode 100644 index 00000000..99c66c16 --- /dev/null +++ b/assets/index.html-KA0_6BkE.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-5bc93818","path":"/category/","title":"分类","lang":"zh-CN","frontmatter":{"title":"分类","dir":{"index":false},"index":false,"feed":false,"sitemap":false,"blog":{"type":"category","key":"category"},"layout":"BlogCategory","description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/category/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"分类"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"分类\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":0},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-Kh7ogoCl.js b/assets/index.html-Kh7ogoCl.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-Kh7ogoCl.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-Liu-Smqv.js b/assets/index.html-Liu-Smqv.js new file mode 100644 index 00000000..fc8af7c6 --- /dev/null +++ b/assets/index.html-Liu-Smqv.js @@ -0,0 +1 @@ +import{_ as o}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as t,o as n,c,b as r}from"./app-hbwtiwmf.js";const a={};function _(s,l){const e=t("AutoCatalog");return n(),c("div",null,[r(e)])}const i=o(a,[["render",_],["__file","index.html.vue"]]);export{i as default}; diff --git a/assets/index.html-Mm5OOXfz.js b/assets/index.html-Mm5OOXfz.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-Mm5OOXfz.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-N_67P6-s.js b/assets/index.html-N_67P6-s.js new file mode 100644 index 00000000..2b28a2de --- /dev/null +++ b/assets/index.html-N_67P6-s.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-cfe8b6c8","path":"/cloudnative/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/cloudnative/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"cloudnative/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-O3ychtCt.js b/assets/index.html-O3ychtCt.js new file mode 100644 index 00000000..2edfe9fc --- /dev/null +++ b/assets/index.html-O3ychtCt.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-f48afbfc","path":"/kafka/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/kafka/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"kafka/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-P1jiBi7F.js b/assets/index.html-P1jiBi7F.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-P1jiBi7F.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-P7BZhZZ3.js b/assets/index.html-P7BZhZZ3.js new file mode 100644 index 00000000..fb9408d0 --- /dev/null +++ b/assets/index.html-P7BZhZZ3.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-01560935","path":"/timeline/","title":"时间轴","lang":"zh-CN","frontmatter":{"title":"时间轴","dir":{"index":false},"index":false,"feed":false,"sitemap":false,"blog":{"type":"type","key":"timeline"},"layout":"Timeline","description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/timeline/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"时间轴"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"时间轴\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":0},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-PmT0lkiJ.js b/assets/index.html-PmT0lkiJ.js new file mode 100644 index 00000000..b1ba5039 --- /dev/null +++ b/assets/index.html-PmT0lkiJ.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-380c630d","path":"/database/elasticsearch/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/elasticsearch/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"database/elasticsearch/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-T1X0V1oK.js b/assets/index.html-T1X0V1oK.js new file mode 100644 index 00000000..014a3421 --- /dev/null +++ b/assets/index.html-T1X0V1oK.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-8daa1a0e","path":"/","title":"","lang":"zh-CN","frontmatter":{"description":"目录 一、Java 1.1 一次jvm调优过程.md 1.2 JVM调优参数.md 1.3 serverlog.md 1.4 【elasticsearch】搜索过程详解 1.5 基于kubernetes的分布式限流 二、大数据 3.1 elastic-spark.md 三、个人网站 3.1 历史与架构.md 3.2 Lucene的使用.md 3.3 定时任务.md 3.4 日志系统.md 3.5 小集群部署.md 3.6 数据库备份.md 3.7 那些牛逼的插件.md 3.8 基于贝叶斯的情感分析.md 3.9 网站性能优化.md 四、DevOps 4.1 DevOps平台.md 4.2 jenkins-x 4.3 tekton 4.4 Git 五、Kubernetes 六、云原生 七、redis 7.1 redis缓存.md 八、mysql 8.1 mysql缓存.md 面试 算法 jvm kafka mysql kubernetes 生活 3017.md 3018.md 3019.md","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"目录 一、Java 1.1 一次jvm调优过程.md 1.2 JVM调优参数.md 1.3 serverlog.md 1.4 【elasticsearch】搜索过程详解 1.5 基于kubernetes的分布式限流 二、大数据 3.1 elastic-spark.md 三、个人网站 3.1 历史与架构.md 3.2 Lucene的使用.md 3.3 定时任务.md 3.4 日志系统.md 3.5 小集群部署.md 3.6 数据库备份.md 3.7 那些牛逼的插件.md 3.8 基于贝叶斯的情感分析.md 3.9 网站性能优化.md 四、DevOps 4.1 DevOps平台.md 4.2 jenkins-x 4.3 tekton 4.4 Git 五、Kubernetes 六、云原生 七、redis 7.1 redis缓存.md 八、mysql 8.1 mysql缓存.md 面试 算法 jvm kafka mysql kubernetes 生活 3017.md 3018.md 3019.md"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:46:04.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:46:04.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:46:04.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706183164000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":5}]},"readingTime":{"minutes":1.03,"words":309},"filePathRelative":"README.md","localizedDate":"2024年1月24日","excerpt":"\\n","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-TGCezLqp.js b/assets/index.html-TGCezLqp.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-TGCezLqp.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-XULjGA2d.js b/assets/index.html-XULjGA2d.js new file mode 100644 index 00000000..6945e299 --- /dev/null +++ b/assets/index.html-XULjGA2d.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-154dc4c4","path":"/star/","title":"星标","lang":"zh-CN","frontmatter":{"title":"星标","dir":{"index":false},"index":false,"feed":false,"sitemap":false,"blog":{"type":"type","key":"star"},"layout":"BlogType","description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/star/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"星标"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"星标\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":0},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-XmG6pc7W.js b/assets/index.html-XmG6pc7W.js new file mode 100644 index 00000000..b74c6825 --- /dev/null +++ b/assets/index.html-XmG6pc7W.js @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as n,c as s,a as e,d as a}from"./app-hbwtiwmf.js";const o="/assets/img_1-mEcVW6nR.png",c={},r=e("h1",{id:"微信支付",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#微信支付","aria-hidden":"true"},"#"),a(" 微信支付")],-1),i=e("figure",null,[e("img",{src:o,alt:"微信支付",tabindex:"0"}),e("figcaption",null,"微信支付")],-1),_=[r,i];function d(l,m){return n(),s("div",null,_)}const u=t(c,[["render",d],["__file","index.html.vue"]]);export{u as default}; diff --git a/assets/index.html-b505XBQM.js b/assets/index.html-b505XBQM.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-b505XBQM.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-bfztJVUA.js b/assets/index.html-bfztJVUA.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-bfztJVUA.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-bm3LruVY.js b/assets/index.html-bm3LruVY.js new file mode 100644 index 00000000..3e21010a --- /dev/null +++ b/assets/index.html-bm3LruVY.js @@ -0,0 +1 @@ +import{_ as a}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as i,o as E,c as o,a as l,b as t,w as u,d as n}from"./app-hbwtiwmf.js";const d={},s=l("nav",{class:"table-of-contents"},[l("ul")],-1);function m(B,r){const e=i("RouterLink");return E(),o("div",null,[s,l("ul",null,[l("li",null,[l("p",null,[t(e,{to:"/"},{default:u(()=>[n("目录")]),_:1})])]),l("li",null,[l("p",null,[t(e,{to:"/java/"},{default:u(()=>[n("一、Java")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html"},{default:u(()=>[n("1.1 一次jvm调优过程.md")]),_:1})]),l("li",null,[t(e,{to:"/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html"},{default:u(()=>[n("1.2 JVM调优参数.md")]),_:1})]),l("li",null,[t(e,{to:"/java/serverlog.html"},{default:u(()=>[n("1.3 serverlog.md")]),_:1})]),l("li",null,[t(e,{to:"/database/elasticsearch/es8.0%E7%BB%83%E4%B9%A0.html"},{default:u(()=>[n("1.4 【elasticsearch】搜索过程详解")]),_:1})]),l("li",null,[t(e,{to:"/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html"},{default:u(()=>[n("1.5 基于kubernetes的分布式限流")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/bigdata/"},{default:u(()=>[n("二、大数据")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/bigdata/spark/elastic-spark.html"},{default:u(()=>[n("3.1 elastic-spark.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/personalWebsite/"},{default:u(()=>[n("三、个人网站")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html"},{default:u(()=>[n("3.1 历史与架构.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html"},{default:u(()=>[n("3.2 Lucene的使用.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html"},{default:u(()=>[n("3.3 定时任务.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html"},{default:u(()=>[n("3.4 日志系统.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html"},{default:u(()=>[n("3.5 小集群部署.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html"},{default:u(()=>[n("3.6 数据库备份.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html"},{default:u(()=>[n("3.7 那些牛逼的插件.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html"},{default:u(()=>[n("3.8 基于贝叶斯的情感分析.md")]),_:1})]),l("li",null,[t(e,{to:"/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html"},{default:u(()=>[n("3.9 网站性能优化.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/devops/"},{default:u(()=>[n("四、DevOps")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/devops/devops-ping-tai.html"},{default:u(()=>[n("4.1 DevOps平台.md")]),_:1})]),l("li",null,[t(e,{to:"/devops/jenkins-x.html"},{default:u(()=>[n("4.2 jenkins-x")]),_:1})]),l("li",null,[t(e,{to:"/devops/tekton.html"},{default:u(()=>[n("4.3 tekton")]),_:1})]),l("li",null,[t(e,{to:"/devops/gitlab-ci.html"},{default:u(()=>[n("4.4 Git")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/kubernetes/"},{default:u(()=>[n("五、Kubernetes")]),_:1})])]),l("li",null,[l("p",null,[t(e,{to:"/cloudnative/"},{default:u(()=>[n("六、云原生")]),_:1})])]),l("li",null,[l("p",null,[t(e,{to:"/redis/"},{default:u(()=>[n("七、redis")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/redis/redis%E7%BC%93%E5%AD%98.html"},{default:u(()=>[n("7.1 redis缓存.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/database/mysql/"},{default:u(()=>[n("八、mysql")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html"},{default:u(()=>[n("8.1 mysql缓存.md")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/interview/"},{default:u(()=>[n("面试")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/interview/%E7%AE%97%E6%B3%95.html"},{default:u(()=>[n("算法")]),_:1})]),l("li",null,[t(e,{to:"/interview/jvm.html"},{default:u(()=>[n("jvm")]),_:1})]),l("li",null,[t(e,{to:"/interview/kafka.html"},{default:u(()=>[n("kafka")]),_:1})]),l("li",null,[t(e,{to:"/interview/mysql.html"},{default:u(()=>[n("mysql")]),_:1})]),l("li",null,[t(e,{to:"/interview/kubernetes.html"},{default:u(()=>[n("kubernetes")]),_:1})])])]),l("li",null,[l("p",null,[t(e,{to:"/life/"},{default:u(()=>[n("生活")]),_:1})]),l("ul",null,[l("li",null,[t(e,{to:"/life/2017.html"},{default:u(()=>[n("3017.md")]),_:1})]),l("li",null,[t(e,{to:"/life/2018.html"},{default:u(()=>[n("3018.md")]),_:1})]),l("li",null,[t(e,{to:"/life/2019.html"},{default:u(()=>[n("3019.md")]),_:1})])])])])])}const p=a(d,[["render",m],["__file","index.html.vue"]]);export{p as default}; diff --git a/assets/index.html-fplo8Du9.js b/assets/index.html-fplo8Du9.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-fplo8Du9.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-jiCpawhO.js b/assets/index.html-jiCpawhO.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-jiCpawhO.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-k7gT6RRu.js b/assets/index.html-k7gT6RRu.js new file mode 100644 index 00000000..ddf23961 --- /dev/null +++ b/assets/index.html-k7gT6RRu.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-21e54510","path":"/kubernetes/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/kubernetes/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"kubernetes/README.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-lNr9aQbu.js b/assets/index.html-lNr9aQbu.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-lNr9aQbu.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-mwc9jQFp.js b/assets/index.html-mwc9jQFp.js new file mode 100644 index 00000000..fc8af7c6 --- /dev/null +++ b/assets/index.html-mwc9jQFp.js @@ -0,0 +1 @@ +import{_ as o}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as t,o as n,c,b as r}from"./app-hbwtiwmf.js";const a={};function _(s,l){const e=t("AutoCatalog");return n(),c("div",null,[r(e)])}const i=o(a,[["render",_],["__file","index.html.vue"]]);export{i as default}; diff --git a/assets/index.html-n0ldjUQW.js b/assets/index.html-n0ldjUQW.js new file mode 100644 index 00000000..092888db --- /dev/null +++ b/assets/index.html-n0ldjUQW.js @@ -0,0 +1 @@ +import{_ as n}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as s,o as r,c,a as e,b as l,w as a,d as o}from"./app-hbwtiwmf.js";const m={};function _(d,u){const t=s("RouterLink");return r(),c("div",null,[e("ul",null,[e("li",null,[l(t,{to:"/database/mysql/"},{default:a(()=>[o("八、mysql")]),_:1}),e("ul",null,[e("li",null,[l(t,{to:"/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html"},{default:a(()=>[o("8.1 mysql缓存.md")]),_:1})])])])])])}const p=n(m,[["render",_],["__file","index.html.vue"]]);export{p as default}; diff --git a/assets/index.html-oqBikOM4.js b/assets/index.html-oqBikOM4.js new file mode 100644 index 00000000..94bc8eca --- /dev/null +++ b/assets/index.html-oqBikOM4.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(n,_){return t(),c("div")}const f=e(o,[["render",r],["__file","index.html.vue"]]);export{f as default}; diff --git a/assets/index.html-vgYoWX9F.js b/assets/index.html-vgYoWX9F.js new file mode 100644 index 00000000..b5b4d971 --- /dev/null +++ b/assets/index.html-vgYoWX9F.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-71b3ae87","path":"/interview/","title":"Interview","lang":"zh-CN","frontmatter":{"title":"Interview","article":false,"feed":false,"sitemap":false,"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/interview/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"Interview"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"Interview\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":1},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-xgoJibcf.js b/assets/index.html-xgoJibcf.js new file mode 100644 index 00000000..a67d4303 --- /dev/null +++ b/assets/index.html-xgoJibcf.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-258f309e","path":"/open-source-project/","title":"","lang":"zh-CN","frontmatter":{"description":"jfaowejfoewj","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/open-source-project/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"jfaowejfoewj"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":1},"filePathRelative":"open-source-project/README.md","localizedDate":"2024年1月24日","excerpt":"

jfaowejfoewj

\\n","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-yuZKtvix.js b/assets/index.html-yuZKtvix.js new file mode 100644 index 00000000..266ce1bb --- /dev/null +++ b/assets/index.html-yuZKtvix.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-14c69af4","path":"/java/","title":"Java","lang":"zh-CN","frontmatter":{"title":"Java","article":false,"feed":false,"sitemap":false,"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"Java"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"Java\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":1},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-zEn3PTqR.js b/assets/index.html-zEn3PTqR.js new file mode 100644 index 00000000..80418a6c --- /dev/null +++ b/assets/index.html-zEn3PTqR.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-71fde78e","path":"/devops/","title":"三、DevOps","lang":"zh-CN","frontmatter":{"description":"三、DevOps DevOps DevOps平台 Gitlab-ci jenkins-x.md tekton","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/devops/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"三、DevOps"}],["meta",{"property":"og:description","content":"三、DevOps DevOps DevOps平台 Gitlab-ci jenkins-x.md tekton"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"三、DevOps\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.08,"words":24},"filePathRelative":"devops/README.md","localizedDate":"2024年1月24日","excerpt":"

三、DevOps

\\n","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-zdhpQIq5.js b/assets/index.html-zdhpQIq5.js new file mode 100644 index 00000000..c0b39189 --- /dev/null +++ b/assets/index.html-zdhpQIq5.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-25b47c13","path":"/others/","title":"Others","lang":"zh-CN","frontmatter":{"title":"Others","article":false,"feed":false,"sitemap":false,"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/others/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"Others"}],["meta",{"property":"og:type","content":"website"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"article:author","content":"Zephery"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"WebPage\\",\\"name\\":\\"Others\\"}"]]},"headers":[],"git":{},"readingTime":{"minutes":0,"words":1},"filePathRelative":null,"excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/index.html-zovaOK4R.js b/assets/index.html-zovaOK4R.js new file mode 100644 index 00000000..d2fcd8ca --- /dev/null +++ b/assets/index.html-zovaOK4R.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-60fc7530","path":"/bigdata/spark/","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/bigdata/spark/"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706182936000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"bigdata/spark/README.md","localizedDate":"2024年1月25日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/jenkins-x.html-erfIag1T.js b/assets/jenkins-x.html-erfIag1T.js new file mode 100644 index 00000000..66122f9a --- /dev/null +++ b/assets/jenkins-x.html-erfIag1T.js @@ -0,0 +1 @@ +import{_ as n}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as s,c as t,a as e,d as a}from"./app-hbwtiwmf.js";const o={},r=e("h1",{id:"jenkins-x",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#jenkins-x","aria-hidden":"true"},"#"),a(" jenkins-x")],-1),c=[r];function i(_,d){return s(),t("div",null,c)}const f=n(o,[["render",i],["__file","jenkins-x.html.vue"]]);export{f as default}; diff --git a/assets/jenkins-x.html-gi90zyZ8.js b/assets/jenkins-x.html-gi90zyZ8.js new file mode 100644 index 00000000..03dd6c23 --- /dev/null +++ b/assets/jenkins-x.html-gi90zyZ8.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-132efcd1","path":"/devops/jenkins-x.html","title":"jenkins-x","lang":"zh-CN","frontmatter":{"description":"jenkins-x","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/devops/jenkins-x.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"jenkins-x"}],["meta",{"property":"og:description","content":"jenkins-x"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"jenkins-x\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.01,"words":2},"filePathRelative":"devops/jenkins-x.md","localizedDate":"2024年1月24日","excerpt":"

jenkins-x

\\n","autoDesc":true}');export{e as data}; diff --git a/assets/jvm.html-Ul6aSXYe.js b/assets/jvm.html-Ul6aSXYe.js new file mode 100644 index 00000000..ba0c2987 --- /dev/null +++ b/assets/jvm.html-Ul6aSXYe.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-375ccf42","path":"/interview/jvm.html","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/interview/jvm.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.02,"words":6},"filePathRelative":"interview/jvm.md","localizedDate":"2024年1月24日","excerpt":"
\\n
\\"\\"
\\n
\\n","autoDesc":true}');export{e as data}; diff --git a/assets/jvm.html-X0c_jgVl.js b/assets/jvm.html-X0c_jgVl.js new file mode 100644 index 00000000..2d9ab5ca --- /dev/null +++ b/assets/jvm.html-X0c_jgVl.js @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as c,c as n,a as e}from"./app-hbwtiwmf.js";const o={},a=e("div",{align:"center"},[e("figure",null,[e("img",{src:"http://image.wenzhihuai.com/images/202002260829012133856189.png",alt:"",tabindex:"0"}),e("figcaption")])],-1),i=[a];function r(s,_){return c(),n("div",null,i)}const f=t(o,[["render",r],["__file","jvm.html.vue"]]);export{f as default}; diff --git a/assets/kafka.html-LwoA1S_5.js b/assets/kafka.html-LwoA1S_5.js new file mode 100644 index 00000000..e52adefb --- /dev/null +++ b/assets/kafka.html-LwoA1S_5.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-d642798c","path":"/interview/kafka.html","title":"","lang":"zh-CN","frontmatter":{"description":"1、请说明什么是Apache Kafka? Apache Kafka是由Apache开发的一种发布订阅消息系统,它是一个分布式的、分区的和可复制的提交日志服务。 2、说说Kafka的使用场景? ①异步处理 ②应用解耦 ③流量削峰 ④日志处理 ⑤消息通讯等。 3、使用Kafka有什么优点和缺点? 优点: ①支持跨数据中心的消息复制; ②单机吞吐量:十万级,最大的优点,就是吞吐量高; ③topic数量都吞吐量的影响:topic从几十个到几百个的时候,吞吐量会大幅度下降。所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源; ④时效性:ms级; ⑤可用性:非常高,kafka是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用; ⑥消息可靠性:经过参数优化配置,消息可以做到0丢失; ⑦功能支持:功能较为简单,主要支持简单的MQ功能,在大数据领域的实时计算以及日志采集被大规模使用。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/interview/kafka.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"1、请说明什么是Apache Kafka? Apache Kafka是由Apache开发的一种发布订阅消息系统,它是一个分布式的、分区的和可复制的提交日志服务。 2、说说Kafka的使用场景? ①异步处理 ②应用解耦 ③流量削峰 ④日志处理 ⑤消息通讯等。 3、使用Kafka有什么优点和缺点? 优点: ①支持跨数据中心的消息复制; ②单机吞吐量:十万级,最大的优点,就是吞吐量高; ③topic数量都吞吐量的影响:topic从几十个到几百个的时候,吞吐量会大幅度下降。所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源; ④时效性:ms级; ⑤可用性:非常高,kafka是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用; ⑥消息可靠性:经过参数优化配置,消息可以做到0丢失; ⑦功能支持:功能较为简单,主要支持简单的MQ功能,在大数据领域的实时计算以及日志采集被大规模使用。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":17,"words":5099},"filePathRelative":"interview/kafka.md","localizedDate":"2024年1月24日","excerpt":"

1、请说明什么是Apache Kafka?
\\nApache Kafka是由Apache开发的一种发布订阅消息系统,它是一个分布式的、分区的和可复制的提交日志服务。

\\n

2、说说Kafka的使用场景?
\\n①异步处理
\\n②应用解耦
\\n③流量削峰
\\n④日志处理
\\n⑤消息通讯等。

\\n

3、使用Kafka有什么优点和缺点?
\\n优点:
\\n①支持跨数据中心的消息复制;
\\n②单机吞吐量:十万级,最大的优点,就是吞吐量高;
\\n③topic数量都吞吐量的影响:topic从几十个到几百个的时候,吞吐量会大幅度下降。所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源;
\\n④时效性:ms级;
\\n⑤可用性:非常高,kafka是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用;
\\n⑥消息可靠性:经过参数优化配置,消息可以做到0丢失;
\\n⑦功能支持:功能较为简单,主要支持简单的MQ功能,在大数据领域的实时计算以及日志采集被大规模使用。

","autoDesc":true}');export{e as data}; diff --git a/assets/kafka.html-XPZSDjhE.js b/assets/kafka.html-XPZSDjhE.js new file mode 100644 index 00000000..78230cab --- /dev/null +++ b/assets/kafka.html-XPZSDjhE.js @@ -0,0 +1 @@ +import{_ as r}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as a,c as e,e as b}from"./app-hbwtiwmf.js";const k={},o=b("

1、请说明什么是Apache Kafka?
Apache Kafka是由Apache开发的一种发布订阅消息系统,它是一个分布式的、分区的和可复制的提交日志服务。

2、说说Kafka的使用场景?
①异步处理
②应用解耦
③流量削峰
④日志处理
⑤消息通讯等。

3、使用Kafka有什么优点和缺点?
优点:
①支持跨数据中心的消息复制;
②单机吞吐量:十万级,最大的优点,就是吞吐量高;
③topic数量都吞吐量的影响:topic从几十个到几百个的时候,吞吐量会大幅度下降。所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源;
④时效性:ms级;
⑤可用性:非常高,kafka是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用;
⑥消息可靠性:经过参数优化配置,消息可以做到0丢失;
⑦功能支持:功能较为简单,主要支持简单的MQ功能,在大数据领域的实时计算以及日志采集被大规模使用。

缺点:
①由于是批量发送,数据并非真正的实时; 仅支持统一分区内消息有序,无法实现全局消息有序;
②有可能消息重复消费;
③依赖zookeeper进行元数据管理,等等。

4、为什么说Kafka性能很好,体现在哪里?
①顺序读写
②零拷贝
③分区
④批量发送
⑤数据压缩

5、请说明什么是传统的消息传递方法?
传统的消息传递方法包括两种:
排队:在队列中,一组用户可以从服务器中读取消息,每条消息都发送给其中一个人。
发布-订阅:在这个模型中,消息被广播给所有的用户。

6、请说明Kafka相对传统技术有什么优势?
①快速:单一的Kafka代理可以处理成千上万的客户端,每秒处理数兆字节的读写操作。
②可伸缩:在一组机器上对数据进行分区
③和简化,以支持更大的数据
④持久:消息是持久性的,并在集群中进
⑤行复制,以防止数据丢失。
⑥设计:它提供了容错保证和持久性

7、解释Kafka的Zookeeper是什么?我们可以在没有Zookeeper的情况下使用Kafka吗?
Zookeeper是一个开放源码的、高性能的协调服务,它用于Kafka的分布式应用。
不,不可能越过Zookeeper,直接联系Kafka broker。一旦Zookeeper停止工作,它就不能服务客户端请求。
Zookeeper主要用于在集群中不同节点之间进行通信
在Kafka中,它被用于提交偏移量,因此如果节点在任何情况下都失败了,它都可以从之前提交的偏移量中获取
除此之外,它还执行其他活动,如: leader检测、分布式同步、配置管理、识别新节点何时离开或连接、集群、节点实时状态等等。

8、解释Kafka的用户如何消费信息?
在Kafka中传递消息是通过使用sendfile API完成的。它支持将字节从套接口转移到磁盘,通过内核空间保存副本,并在内核用户之间调用内核。

9、解释如何提高远程用户的吞吐量?
如果用户位于与broker不同的数据中心,则可能需要调优套接口缓冲区大小,以对长网络延迟进行摊销。

10、解释一下,在数据制作过程中,你如何能从Kafka得到准确的信息?
在数据中,为了精确地获得Kafka的消息,你必须遵循两件事: 在数据消耗期间避免重复,在数据生产过程中避免重复。
这里有两种方法,可以在数据生成时准确地获得一个语义:
每个分区使用一个单独的写入器,每当你发现一个网络错误,检查该分区中的最后一条消息,以查看您的最后一次写入是否成功
在消息中包含一个主键(UUID或其他),并在用户中进行反复制

11、解释如何减少ISR中的扰动?broker什么时候离开ISR?
ISR是一组与leaders完全同步的消息副本,也就是说ISR中包含了所有提交的消息。ISR应该总是包含所有的副本,直到出现真正的故障。如果一个副本从leader中脱离出来,将会从ISR中删除。

12、Kafka为什么需要复制?
Kafka的信息复制确保了任何已发布的消息不会丢失,并且可以在机器错误、程序错误或更常见些的软件升级中使用。

13、如果副本在ISR中停留了很长时间表明什么?
如果一个副本在ISR中保留了很长一段时间,那么它就表明,跟踪器无法像在leader收集数据那样快速地获取数据。

14、请说明如果首选的副本不在ISR中会发生什么?
如果首选的副本不在ISR中,控制器将无法将leadership转移到首选的副本。

15、有可能在生产后发生消息偏移吗?
在大多数队列系统中,作为生产者的类无法做到这一点,它的作用是触发并忘记消息。broker将完成剩下的工作,比如使用id进行适当的元数据处理、偏移量等。

作为消息的用户,你可以从Kafka broker中获得补偿。如果你注视SimpleConsumer类,你会注意到它会获取包括偏移量作为列表的MultiFetchResponse对象。此外,当你对Kafka消息进行迭代时,你会拥有包括偏移量和消息发送的MessageAndOffset对象。

16、Kafka的设计时什么样的呢?
Kafka将消息以topic为单位进行归纳 将向Kafka topic发布消息的程序成为producers. 将预订topics并消费消息的程序成为consumer. Kafka以集群的方式运行,可以由一个或多个服务组成,每个服务叫做一个broker. producers通过网络将消息发送到Kafka集群,集群向消费者提供消息

17、数据传输的事物定义有哪三种?
(1)最多一次:
消息不会被重复发送,最多被传输一次,但也有可能一次不传输
(2)最少一次: 消息不会被漏发送,最少被传输一次,但也有可能被重复传输.
(3)精确的一次(Exactly once): 不会漏传输也不会重复传输,每个消息都传输被一次而且仅仅被传输一次,这是大家所期望的

18、Kafka判断一个节点是否还活着有那两个条件?
(1)节点必须可以维护和ZooKeeper的连接,Zookeeper通过心跳机制检查每个节点的连接
(2)如果节点是个follower,他必须能及时的同步leader的写操作,延时不能太久

19、producer是否直接将数据发送到broker的leader(主节点)?
producer直接将数据发送到broker的leader(主节点),不需要在多个节点进行分发,为了帮助producer做到这点,所有的Kafka节点都可以及时的告知:哪些节点是活动的,目标topic目标分区的leader在哪。这样producer就可以直接将消息发送到目的地了。

20、Kafa consumer是否可以消费指定分区消息?
Kafa consumer消费消息时,向broker发出"fetch"请求去消费特定分区的消息,consumer指定消息在日志中的偏移量(offset),就可以消费从这个位置开始的消息,customer拥有了offset的控制权,可以向后回滚去重新消费之前的消息,这是很有意义的

21、Kafka消息是采用Pull模式,还是Push模式?
Kafka最初考虑的问题是,customer应该从brokes拉取消息还是brokers将消息推送到consumer,也就是pull还push。在这方面,Kafka遵循了一种大部分消息系统共同的传统的设计:producer将消息推送到broker,consumer从broker拉取消息一些消息系统比如Scribe和Apache Flume采用了push模式,将消息推送到下游的consumer。这样做有好处也有坏处:由broker决定消息推送的速率,对于不同消费速率的consumer就不太好处理了。消息系统都致力于让consumer以最大的速率最快速的消费消息,但不幸的是,push模式下,当broker推送的速率远大于consumer消费的速率时,consumer恐怕就要崩溃了。最终Kafka还是选取了传统的pull模式

Pull模式的另外一个好处是consumer可以自主决定是否批量的从broker拉取数据。Push模式必须在不知道下游consumer消费能力和消费策略的情况下决定是立即推送每条消息还是缓存之后批量推送。如果为了避免consumer崩溃而采用较低的推送速率,将可能导致一次只推送较少的消息而造成浪费。Pull模式下,consumer就可以根据自己的消费能力去决定这些策略

Pull有个缺点是,如果broker没有可供消费的消息,将导致consumer不断在循环中轮询,直到新消息到t达。为了避免这点,Kafka有个参数可以让consumer阻塞知道新消息到达(当然也可以阻塞知道消息的数量达到某个特定的量这样就可以批量发

22、Kafka存储在硬盘上的消息格式是什么?
消息由一个固定长度的头部和可变长度的字节数组组成。头部包含了一个版本号和CRC32校验码。
消息长度: 4 bytes (value: 1+4+n)
版本号: 1 byte
CRC校验码: 4 bytes
具体的消息: n bytes

23、Kafka高效文件存储设计特点:
(1).Kafka把topic中一个parition大文件分成多个小文件段,通过多个小文件段,就容易定期清除或删除已经消费完文件,减少磁盘占用。
(2).通过索引信息可以快速定位message和确定response的最大大小。
(3).通过index元数据全部映射到memory,可以避免segment file的IO磁盘操作。
(4).通过索引文件稀疏存储,可以大幅降低index文件元数据占用空间大小。

24、Kafka 与传统消息系统之间有三个关键区别
(1).Kafka 持久化日志,这些日志可以被重复读取和无限期保留
(2).Kafka 是一个分布式系统:它以集群的方式运行,可以灵活伸缩,在内部通过复制数据提升容错能力和高可用性
(3).Kafka 支持实时的流式处理

25、Kafka创建Topic时如何将分区放置到不同的Broker中
副本因子不能大于 Broker 的个数;
第一个分区(编号为0)的第一个副本放置位置是随机从 brokerList 选择的;
其他分区的第一个副本放置位置相对于第0个分区依次往后移。也就是如果我们有5个 Broker,5个分区,假设第一个分区放在第四个 Broker 上,那么第二个分区将会放在第五个 Broker 上;第三个分区将会放在第一个 Broker 上;第四个分区将会放在第二个 Broker 上,依次类推;
剩余的副本相对于第一个副本放置位置其实是由 nextReplicaShift 决定的,而这个数也是随机产生的

26、Kafka新建的分区会在哪个目录下创建
在启动 Kafka 集群之前,我们需要配置好 log.dirs 参数,其值是 Kafka 数据的存放目录,这个参数可以配置多个目录,目录之间使用逗号分隔,通常这些目录是分布在不同的磁盘上用于提高读写性能。 当然我们也可以配置 log.dir 参数,含义一样。只需要设置其中一个即可。 如果 log.dirs 参数只配置了一个目录,那么分配到各个 Broker 上的分区肯定只能在这个目录下创建文件夹用于存放数据。 但是如果 log.dirs 参数配置了多个目录,那么 Kafka 会在哪个文件夹中创建分区目录呢?答案是:Kafka 会在含有分区目录最少的文件夹中创建新的分区目录,分区目录名为 Topic名+分区ID。注意,是分区文件夹总数最少的目录,而不是磁盘使用量最少的目录!也就是说,如果你给 log.dirs 参数新增了一个新的磁盘,新的分区目录肯定是先在这个新的磁盘上创建直到这个新的磁盘目录拥有的分区目录不是最少为止。

27、partition的数据如何保存到硬盘
topic中的多个partition以文件夹的形式保存到broker,每个分区序号从0递增, 且消息有序 Partition文件下有多个segment(xxx.index,xxx.log) segment 文件里的 大小和配置文件大小一致可以根据要求修改 默认为1g 如果大小大于1g时,会滚动一个新的segment并且以上一个segment最后一条消息的偏移量命名

28、kafka的ack机制
request.required.acks有三个值 0 1 -1
0:生产者不会等待broker的ack,这个延迟最低但是存储的保证最弱当server挂掉的时候就会丢数据
1:服务端会等待ack值 leader副本确认接收到消息后发送ack但是如果leader挂掉后他不确保是否复制完成新leader也会导致数据丢失
-1:同样在1的基础上 服务端会等所有的follower的副本受到数据后才会受到leader发出的ack,这样数据不会丢失

29、Kafka的消费者如何消费数据
消费者每次消费数据的时候,消费者都会记录消费的物理偏移量(offset)的位置 等到下次消费时,他会接着上次位置继续消费。同时也可以按照指定的offset进行重新消费。

30、消费者负载均衡策略
结合consumer的加入和退出进行再平衡策略。

31、kafka消息数据是否有序?
消费者组里某具体分区是有序的,所以要保证有序只能建一个分区,但是实际这样会存在性能问题,具体业务具体分析后确认。

32、kafaka生产数据时数据的分组策略,生产者决定数据产生到集群的哪个partition中
每一条消息都是以(key,value)格式 Key是由生产者发送数据传入 所以生产者(key)决定了数据产生到集群的哪个partition

33、kafka consumer 什么情况会触发再平衡reblance?
①一旦消费者加入或退出消费组,导致消费组成员列表发生变化,消费组中的所有消费者都要执行再平衡。
②订阅主题分区发生变化,所有消费者也都要再平衡。

34、描述下kafka consumer 再平衡步骤?
①关闭数据拉取线程,情空队列和消息流,提交偏移量;
②释放分区所有权,删除zk中分区和消费者的所有者关系;
③将所有分区重新分配给每个消费者,每个消费者都会分到不同分区;
④将分区对应的消费者所有关系写入ZK,记录分区的所有权信息;
⑤重启消费者拉取线程管理器,管理每个分区的拉取线程。

35、Kafka中的ISR、AR又代表什么?ISR的伸缩又指什么
36、Kafka中的HW、LEO、LSO、LW等分别代表什么?
37、Kafka中是怎么体现消息顺序性的?
38、Kafka中的分区器、序列化器、拦截器是否了解?它们之间的处理顺序是什么?
39、Kafka生产者客户端的整体结构是什么样子的?
40、Kafka生产者客户端中使用了几个线程来处理?分别是什么?
41、Kafka的旧版Scala的消费者客户端的设计有什么缺陷?
42、“消费组中的消费者个数如果超过topic的分区,那么就会有消费者消费不到数据”这句话是否正确?如果不正确,那么有没有什么hack的手段?
43、消费者提交消费位移时提交的是当前消费到的最新消息的offset还是offset+1?
44、有哪些情形会造成重复消费?
45、那些情景下会造成消息漏消费?
46、KafkaConsumer是非线程安全的,那么怎么样实现多线程消费?
47、简述消费者与消费组之间的关系
48、当你使用kafka-topics.sh创建(删除)了一个topic之后,Kafka背后会执行什么逻辑?
49、topic的分区数可不可以增加?如果可以怎么增加?如果不可以,那又是为什么?
50、topic的分区数可不可以减少?如果可以怎么减少?如果不可以,那又是为什么?
51、创建topic时如何选择合适的分区数?
52、Kafka目前有那些内部topic,它们都有什么特征?各自的作用又是什么?
53、优先副本是什么?它有什么特殊的作用?
54、Kafka有哪几处地方有分区分配的概念?简述大致的过程及原理
55、简述Kafka的日志目录结构
56、Kafka中有那些索引文件?
57、如果我指定了一个offset,Kafka怎么查找到对应的消息?
58、如果我指定了一个timestamp,Kafka怎么查找到对应的消息?
59、聊一聊你对Kafka的Log Retention的理解
60、聊一聊你对Kafka的Log Compaction的理解
61、聊一聊你对Kafka底层存储的理解(页缓存、内核层、块层、设备层)
62、聊一聊Kafka的延时操作的原理
63、聊一聊Kafka控制器的作用
64、消费再均衡的原理是什么?(提示:消费者协调器和消费组协调器)
65、Kafka中的幂等是怎么实现的
66、Kafka中的事务是怎么实现的(这题我去面试6家被问4次,照着答案念也要念十几分钟,面试官简直凑不要脸。实在记不住的话...只要简历上不写精通Kafka一般不会问到,我简历上写的是“熟悉Kafka,了解RabbitMQ....”)
67、Kafka中有那些地方需要选举?这些地方的选举策略又有哪些?
68、失效副本是指什么?有那些应对措施?
69、多副本下,各个副本中的HW和LEO的演变过程
70、为什么Kafka不支持读写分离?
71、Kafka在可靠性方面做了哪些改进?(HW, LeaderEpoch)
72、Kafka中怎么实现死信队列和重试队列?
73、Kafka中的延迟队列怎么实现(这题被问的比事务那题还要多!!!听说你会Kafka,那你说说延迟队列怎么实现?)
74、Kafka中怎么做消息审计?
75、Kafka中怎么做消息轨迹?
76、Kafka中有那些配置参数比较有意思?聊一聊你的看法
77、Kafka中有那些命名比较有意思?聊一聊你的看法
78、Kafka有哪些指标需要着重关注?
79、怎么计算Lag?(注意read_uncommitted和read_committed状态下的不同)
80、Kafka的那些设计让它有如此高的性能?
81、Kafka有什么优缺点?
82、还用过什么同质类的其它产品,与Kafka相比有什么优缺点?
83、为什么选择Kafka?
84、在使用Kafka的过程中遇到过什么困难?怎么解决的?
85、怎么样才能确保Kafka极大程度上的可靠性?
86、聊一聊你对Kafka生态的理解

",39),p=[o];function f(K,t){return a(),e("div",null,p)}const i=r(k,[["render",f],["__file","kafka.html.vue"]]);export{i as default}; diff --git a/assets/kkjdna-1t0PmkAn.png b/assets/kkjdna-1t0PmkAn.png new file mode 100644 index 00000000..a8d8627b Binary files /dev/null and b/assets/kkjdna-1t0PmkAn.png differ diff --git a/assets/kpdjbc-5yOT32pq.png b/assets/kpdjbc-5yOT32pq.png new file mode 100644 index 00000000..5e69dabc Binary files /dev/null and b/assets/kpdjbc-5yOT32pq.png differ diff --git a/assets/kubernetes.html-CE5xOJPq.js b/assets/kubernetes.html-CE5xOJPq.js new file mode 100644 index 00000000..ae3a2a7b --- /dev/null +++ b/assets/kubernetes.html-CE5xOJPq.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-473223ec","path":"/interview/kubernetes.html","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/interview/kubernetes.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"interview/kubernetes.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/kubernetes.html-OuCY9z9N.js b/assets/kubernetes.html-OuCY9z9N.js new file mode 100644 index 00000000..52e17c3c --- /dev/null +++ b/assets/kubernetes.html-OuCY9z9N.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c as r}from"./app-hbwtiwmf.js";const c={};function o(n,_){return t(),r("div")}const f=e(c,[["render",o],["__file","kubernetes.html.vue"]]);export{f as default}; diff --git "a/assets/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html-YL_BWWs1.js" "b/assets/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html-YL_BWWs1.js" new file mode 100644 index 00000000..e128a769 --- /dev/null +++ "b/assets/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html-YL_BWWs1.js" @@ -0,0 +1 @@ +import{_ as c}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c as a,a as e,d as n}from"./app-hbwtiwmf.js";const o={},r=e("h1",{id:"lucene搜索原理",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#lucene搜索原理","aria-hidden":"true"},"#"),n(" lucene搜索原理")],-1),_=[r];function s(l,d){return t(),a("div",null,_)}const h=c(o,[["render",s],["__file","lucene搜索原理.html.vue"]]);export{h as default}; diff --git "a/assets/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html-xqazIHll.js" "b/assets/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html-xqazIHll.js" new file mode 100644 index 00000000..eca52cfc --- /dev/null +++ "b/assets/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html-xqazIHll.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-478d0de6","path":"/java/lucene%E6%90%9C%E7%B4%A2%E5%8E%9F%E7%90%86.html","title":"lucene搜索原理","lang":"zh-CN","frontmatter":{"description":"lucene搜索原理","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/lucene%E6%90%9C%E7%B4%A2%E5%8E%9F%E7%90%86.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"lucene搜索原理"}],["meta",{"property":"og:description","content":"lucene搜索原理"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"lucene搜索原理\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0.02,"words":5},"filePathRelative":"java/lucene搜索原理.md","localizedDate":"2024年1月24日","excerpt":"

lucene搜索原理

\\n","autoDesc":true}');export{e as data}; diff --git a/assets/mfthul-8EWpI2y9.png b/assets/mfthul-8EWpI2y9.png new file mode 100644 index 00000000..e6f2fee9 Binary files /dev/null and b/assets/mfthul-8EWpI2y9.png differ diff --git a/assets/mrw3cz-WdJLjmEt.png b/assets/mrw3cz-WdJLjmEt.png new file mode 100644 index 00000000..92545a74 Binary files /dev/null and b/assets/mrw3cz-WdJLjmEt.png differ diff --git a/assets/mysql.html-jTFKaNE3.js b/assets/mysql.html-jTFKaNE3.js new file mode 100644 index 00000000..7af5880e --- /dev/null +++ b/assets/mysql.html-jTFKaNE3.js @@ -0,0 +1 @@ +import{_ as e}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c}from"./app-hbwtiwmf.js";const o={};function r(_,s){return t(),c("div")}const l=e(o,[["render",r],["__file","mysql.html.vue"]]);export{l as default}; diff --git a/assets/mysql.html-lzjdbhMn.js b/assets/mysql.html-lzjdbhMn.js new file mode 100644 index 00000000..a27053e6 --- /dev/null +++ b/assets/mysql.html-lzjdbhMn.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-0b13f184","path":"/interview/mysql.html","title":"","lang":"zh-CN","frontmatter":{"description":"","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/interview/mysql.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":0},"filePathRelative":"interview/mysql.md","localizedDate":"2024年1月24日","excerpt":"","autoDesc":true}');export{e as data}; diff --git a/assets/p82i06-OkAl2TIG.png b/assets/p82i06-OkAl2TIG.png new file mode 100644 index 00000000..dabddb65 Binary files /dev/null and b/assets/p82i06-OkAl2TIG.png differ diff --git a/assets/photoswipe.esm-08_zHRDQ.js b/assets/photoswipe.esm-08_zHRDQ.js new file mode 100644 index 00000000..4048314e --- /dev/null +++ b/assets/photoswipe.esm-08_zHRDQ.js @@ -0,0 +1,4 @@ +/*! + * PhotoSwipe 5.4.3 - https://photoswipe.com + * (c) 2023 Dmytro Semenov + */function f(r,t,i){const e=document.createElement(t);return r&&(e.className=r),i&&i.appendChild(e),e}function p(r,t){return r.x=t.x,r.y=t.y,t.id!==void 0&&(r.id=t.id),r}function M(r){r.x=Math.round(r.x),r.y=Math.round(r.y)}function A(r,t){const i=Math.abs(r.x-t.x),e=Math.abs(r.y-t.y);return Math.sqrt(i*i+e*e)}function x(r,t){return r.x===t.x&&r.y===t.y}function I(r,t,i){return Math.min(Math.max(r,t),i)}function b(r,t,i){let e=`translate3d(${r}px,${t||0}px,0)`;return i!==void 0&&(e+=` scale3d(${i},${i},1)`),e}function y(r,t,i,e){r.style.transform=b(t,i,e)}const $="cubic-bezier(.4,0,.22,1)";function R(r,t,i,e){r.style.transition=t?`${t} ${i}ms ${e||$}`:"none"}function L(r,t,i){r.style.width=typeof t=="number"?`${t}px`:t,r.style.height=typeof i=="number"?`${i}px`:i}function U(r){R(r)}function q(r){return"decode"in r?r.decode().catch(()=>{}):r.complete?Promise.resolve(r):new Promise((t,i)=>{r.onload=()=>t(r),r.onerror=i})}const _={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function G(r){return"button"in r&&r.button===1||r.ctrlKey||r.metaKey||r.altKey||r.shiftKey}function K(r,t,i=document){let e=[];if(r instanceof Element)e=[r];else if(r instanceof NodeList||Array.isArray(r))e=Array.from(r);else{const s=typeof r=="string"?r:t;s&&(e=Array.from(i.querySelectorAll(s)))}return e}function C(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}let F=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{F=!0}}))}catch{}class X{constructor(){this._pool=[]}add(t,i,e,s){this._toggleListener(t,i,e,s)}remove(t,i,e,s){this._toggleListener(t,i,e,s,!0)}removeAll(){this._pool.forEach(t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)}),this._pool=[]}_toggleListener(t,i,e,s,n,o){if(!t)return;const a=n?"removeEventListener":"addEventListener";i.split(" ").forEach(l=>{if(l){o||(n?this._pool=this._pool.filter(d=>d.type!==l||d.listener!==e||d.target!==t):this._pool.push({target:t,type:l,listener:e,passive:s}));const c=F?{passive:s||!1}:!1;t[a](l,e,c)}})}}function B(r,t){if(r.getViewportSizeFn){const i=r.getViewportSizeFn(r,t);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function S(r,t,i,e,s){let n=0;if(t.paddingFn)n=t.paddingFn(i,e,s)[r];else if(t.padding)n=t.padding[r];else{const o="padding"+r[0].toUpperCase()+r.slice(1);t[o]&&(n=t[o])}return Number(n)||0}function N(r,t,i,e){return{x:t.x-S("left",r,t,i,e)-S("right",r,t,i,e),y:t.y-S("top",r,t,i,e)-S("bottom",r,t,i,e)}}class Y{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){const{pswp:i}=this.slide,e=this.slide[t==="x"?"width":"height"]*this.currZoomLevel,n=S(t==="x"?"left":"top",i.options,i.viewportSize,this.slide.data,this.slide.index),o=this.slide.panAreaSize[t];this.center[t]=Math.round((o-e)/2)+n,this.max[t]=e>o?Math.round(o-e)+n:this.center[t],this.min[t]=e>o?n:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,i){return I(i,this.max[t],this.min[t])}}const T=4e3;class k{constructor(t,i,e,s){this.pswp=s,this.options=t,this.itemData=i,this.index=e,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,i,e){const s={x:t,y:i};this.elementSize=s,this.panAreaSize=e;const n=e.x/s.x,o=e.y/s.y;this.fit=Math.min(1,no?n:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const i=t+"ZoomLevel",e=this.options[i];if(e)return typeof e=="function"?e(this):e==="fill"?this.fill:e==="fit"?this.fit:Number(e)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,this.fit*3),this.elementSize&&t*this.elementSize.x>T&&(t=T/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}}class j{constructor(t,i,e){this.data=t,this.index=i,this.pswp=e,this.isActive=i===e.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!e.opener.isOpen,this.zoomLevels=new k(e.options,t,i,e),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:i}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=f("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new Y(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:t}=this;this.heavyAppended||!t.opener.isOpen||t.mainScroll.isShifted()||!this.isActive&&!!0||this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this}))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel===this.zoomLevels.initial||!this.isActive?(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize()):(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y))}updateContentSize(t){const i=this.currentResolution||this.zoomLevels.initial;if(!i)return;const e=Math.round(this.width*i)||this.pswp.viewportSize.x,s=Math.round(this.height*i)||this.pswp.viewportSize.y;!this.sizeChanged(e,s)&&!t||this.content.setDisplayedSize(e,s)}sizeChanged(t,i){return t!==this.prevDisplayedWidth||i!==this.prevDisplayedHeight?(this.prevDisplayedWidth=t,this.prevDisplayedHeight=i,!0):!1}getPlaceholderElement(){var t;return(t=this.content.placeholder)===null||t===void 0?void 0:t.element}zoomTo(t,i,e,s){const{pswp:n}=this;if(!this.isZoomable()||n.mainScroll.isShifted())return;n.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:i,transitionDuration:e}),n.animations.stopAllPan();const o=this.currZoomLevel;s||(t=I(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",i,o),this.pan.y=this.calculateZoomToPanOffset("y",i,o),M(this.pan);const a=()=>{this._setResolution(t),this.applyCurrentZoomPan()};e?n.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:a,duration:e,easing:n.options.easing}):a()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,i,e){if(this.bounds.max[t]-this.bounds.min[t]===0)return this.bounds.center[t];i||(i=this.pswp.getViewportCenterPoint()),e||(e=this.zoomLevels.initial);const n=this.currZoomLevel/e;return this.bounds.correctPan(t,(this.pan[t]-i[t])*n+i[t])}panTo(t,i){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",i),this.applyCurrentZoomPan()}isPannable(){return!!this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return!!this.width&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),p(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,i,e){e/=this.currentResolution||this.zoomLevels.initial,y(this.container,t,i,e)}calculateSize(){const{pswp:t}=this;p(this.panAreaSize,N(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return b(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}const Q=.35,J=.6,z=.4,E=.5;function tt(r,t){return r*t/(1-t)}class it{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&p(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:i,dragAxis:e}=this.gestures,{currSlide:s}=this.pswp;if(e==="y"&&this.pswp.options.closeOnVerticalDrag&&s&&s.currZoomLevel<=s.zoomLevels.fit&&!this.gestures.isMultitouch){const n=s.pan.y+(t.y-i.y);if(!this.pswp.dispatch("verticalDrag",{panY:n}).defaultPrevented){this._setPanWithFriction("y",n,J);const o=1-Math.abs(this._getVerticalDragRatio(s.pan.y));this.pswp.applyBgOpacity(o),s.applyCurrentZoomPan()}}else this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),s&&(M(s.pan),s.applyCurrentZoomPan()))}end(){const{velocity:t}=this.gestures,{mainScroll:i,currSlide:e}=this.pswp;let s=0;if(this.pswp.animations.stopAll(),i.isShifted()){const o=(i.x-i.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-E&&o<0||t.x<.1&&o<-.5?(s=1,t.x=Math.min(t.x,0)):(t.x>E&&o>0||t.x>-.1&&o>.5)&&(s=-1,t.x=Math.max(t.x,0)),i.moveIndexBy(s,!0,t.x)}e&&e.currZoomLevel>e.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){const{velocity:i}=this.gestures,{currSlide:e}=this.pswp;if(!e)return;const{pan:s,bounds:n}=e,o=s[t],a=this.pswp.bgOpacity<1&&t==="y",l=o+tt(i[t],.995);if(a){const v=this._getVerticalDragRatio(o),w=this._getVerticalDragRatio(l);if(v<0&&w<-z||v>0&&w>z){this.pswp.close();return}}const c=n.correctPan(t,l);if(o===c)return;const d=c===l?1:.82,u=this.pswp.bgOpacity,m=c-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:o,end:c,velocity:i[t],dampingRatio:d,onUpdate:v=>{if(a&&this.pswp.bgOpacity<1){const w=1-(c-v)/m;this.pswp.applyBgOpacity(I(u+(1-u)*w,0,1))}s[t]=Math.floor(v),e.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){const{p1:i,dragAxis:e,prevP1:s,isMultitouch:n}=this.gestures,{currSlide:o,mainScroll:a}=this.pswp,h=i[t]-s[t],l=a.x+h;if(!h||!o)return!1;if(t==="x"&&!o.isPannable()&&!n)return a.moveTo(l,!0),!0;const{bounds:c}=o,d=o.pan[t]+h;if(this.pswp.options.allowPanToNext&&e==="x"&&t==="x"&&!n){const u=a.getCurrSlideX(),m=a.x-u,v=h>0,w=!v;if(d>c.min[t]&&v){if(c.min[t]<=this.startPan[t])return a.moveTo(l,!0),!0;this._setPanWithFriction(t,d)}else if(d0)return a.moveTo(Math.max(l,u),!0),!0;if(m<0)return a.moveTo(Math.min(l,u),!0),!0}else this._setPanWithFriction(t,d)}else t==="y"?!a.isShifted()&&c.min.y!==c.max.y&&this._setPanWithFriction(t,d):this._setPanWithFriction(t,d);return!1}_getVerticalDragRatio(t){var i,e;return(t-((i=(e=this.pswp.currSlide)===null||e===void 0?void 0:e.bounds.center.y)!==null&&i!==void 0?i:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,i,e){const{currSlide:s}=this.pswp;if(!s)return;const{pan:n,bounds:o}=s;if(o.correctPan(t,i)!==i||e){const h=Math.round(i-n[t]);n[t]+=h*(e||Q)}else n[t]=i}}const et=.05,st=.15;function O(r,t,i){return r.x=(t.x+i.x)/2,r.y=(t.y+i.y)/2,r}class nt{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){const{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,p(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:t,startP1:i,p2:e,startP2:s,pswp:n}=this.gestures,{currSlide:o}=n;if(!o)return;const a=o.zoomLevels.min,h=o.zoomLevels.max;if(!o.isZoomable()||n.mainScroll.isShifted())return;O(this._startZoomPoint,i,s),O(this._zoomPoint,t,e);let l=1/A(i,s)*A(t,e)*this._startZoomLevel;if(l>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),lh&&(l=h+(l-h)*et);o.pan.x=this._calculatePanForZoomLevel("x",l),o.pan.y=this._calculatePanForZoomLevel("y",l),o.setZoomLevel(l),o.applyCurrentZoomPan()}end(){const{pswp:t}=this.gestures,{currSlide:i}=t;(!i||i.currZoomLevele.zoomLevels.max?n=e.zoomLevels.max:(o=!1,n=s);const a=i.bgOpacity,h=i.bgOpacity<1,l=p({x:0,y:0},e.pan);let c=p({x:0,y:0},l);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=s,p(this._startPan,l)),o&&(c={x:this._calculatePanForZoomLevel("x",n),y:this._calculatePanForZoomLevel("y",n)}),e.setZoomLevel(n),c={x:e.bounds.correctPan("x",c.x),y:e.bounds.correctPan("y",c.y)},e.setZoomLevel(s);const d=!x(c,l);if(!d&&!o&&!h){e._setResolution(n),e.applyCurrentZoomPan();return}i.animations.stopAllPan(),i.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:u=>{if(u/=1e3,d||o){if(d&&(e.pan.x=l.x+(c.x-l.x)*u,e.pan.y=l.y+(c.y-l.y)*u),o){const m=s+(n-s)*u;e.setZoomLevel(m)}e.applyCurrentZoomPan()}h&&i.bgOpacity<1&&i.applyBgOpacity(I(a+(1-a)*u,0,1))},onComplete:()=>{e._setResolution(n),e.applyCurrentZoomPan()}})}}function Z(r){return!!r.target.closest(".pswp__container")}class ot{constructor(t){this.gestures=t}click(t,i){const e=i.target.classList,s=e.contains("pswp__img"),n=e.contains("pswp__item")||e.contains("pswp__zoom-wrap");s?this._doClickOrTapAction("imageClick",t,i):n&&this._doClickOrTapAction("bgClick",t,i)}tap(t,i){Z(i)&&this._doClickOrTapAction("tap",t,i)}doubleTap(t,i){Z(i)&&this._doClickOrTapAction("doubleTap",t,i)}_doClickOrTapAction(t,i,e){var s;const{pswp:n}=this.gestures,{currSlide:o}=n,a=t+"Action",h=n.options[a];if(!n.dispatch(a,{point:i,originalEvent:e}).defaultPrevented){if(typeof h=="function"){h.call(n,i,e);return}switch(h){case"close":case"next":n[h]();break;case"zoom":o==null||o.toggleZoom(i);break;case"zoom-or-close":o!=null&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(i):n.options.clickToCloseNonZoomable&&n.close();break;case"toggle-controls":(s=this.gestures.pswp.element)===null||s===void 0||s.classList.toggle("pswp--ui-visible");break}}}}const rt=10,at=300,ht=25;class lt{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new it(this),this.zoomLevels=new nt(this),this.tapHandler=new ot(this),t.on("bindEvents",()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")})}_bindEvents(t,i,e,s){const{pswp:n}=this,{events:o}=n,a=s?t+s:"";o.add(n.scrollWrap,t+i,this.onPointerDown.bind(this)),o.add(window,t+"move",this.onPointerMove.bind(this)),o.add(window,t+e,this.onPointerUp.bind(this)),a&&o.add(n.scrollWrap,a,this.onPointerUp.bind(this))}onPointerDown(t){const i=t.type==="mousedown"||t.pointerType==="mouse";if(i&&t.button>0)return;const{pswp:e}=this;if(!e.opener.isOpen){t.preventDefault();return}e.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(i&&(e.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),e.animations.stopAll(),this._updatePoints(t,"down"),this._numActivePoints===1&&(this.dragAxis=null,p(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1)}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),!this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===1&&!this.isDragging?(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,p(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop())):this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop())))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),!this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===0&&(this._rafStopLoop(),this.isDragging?this._finishDrag():!this.isZooming&&!this.isMultitouch&&this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),this._numActivePoints===1&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?x(this.p1,this.prevP1)||this.drag.change():(!x(this.p1,this.prevP1)||!x(this.p2,this.prevP2))&&this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){const i=Date.now(),e=i-this._intervalTime;e<50&&!t||(this.velocity.x=this._getVelocity("x",e),this.velocity.y=this._getVelocity("y",e),this._intervalTime=i,p(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){const{mainScroll:i}=this.pswp;if(i.isShifted()){i.moveIndexBy(0,!0);return}if(t.type.indexOf("cancel")>0)return;if(t.type==="mouseup"||t.pointerType==="mouse"){this.tapHandler.click(this.startP1,t);return}const e=this.pswp.options.doubleTapAction?at:0;this._tapTimer?(this._clearTapTimer(),A(this._lastStartP1,this.startP1){this.tapHandler.tap(this.startP1,t),this._clearTapTimer()},e))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,i){const e=this.p1[t]-this._intervalP1[t];return Math.abs(e)>1&&i>5?e/i:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,i){this.pswp.applyFilters("preventPointerEvent",!0,t,i)&&t.preventDefault()}_updatePoints(t,i){if(this._pointerEventEnabled){const e=t,s=this._ongoingPointers.findIndex(n=>n.id===e.pointerId);i==="up"&&s>-1?this._ongoingPointers.splice(s,1):i==="down"&&s===-1?this._ongoingPointers.push(this._convertEventPosToPoint(e,{x:0,y:0})):s>-1&&this._convertEventPosToPoint(e,this._ongoingPointers[s]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&p(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&p(this.p2,this._ongoingPointers[1])}else{const e=t;this._numActivePoints=0,e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(this._convertEventPosToPoint(e.touches[0],this.p1),this._numActivePoints++,e.touches.length>1&&(this._convertEventPosToPoint(e.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),i==="up"?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){p(this.prevP1,this.p1),p(this.prevP2,this.p2)}_updateStartPoints(){p(this.startP1,this.p1),p(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(t!==0){const i=t>0?"x":"y";Math.abs(this.p1[i]-this.startP1[i])>=rt&&(this.dragAxis=i)}}}_convertEventPosToPoint(t,i){return i.x=t.pageX-this.pswp.offset.x,i.y=t.pageY-this.pswp.offset.y,"pointerId"in t?i.id=t.pointerId:t.identifier!==void 0&&(i.id=t.identifier),i}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}const ct=.35;class dt{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){const{pswp:i}=this,e=Math.round(i.viewportSize.x+i.viewportSize.x*i.options.spacing),s=e!==this.slideWidth;s&&(this.slideWidth=e,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach((n,o)=>{s&&y(n.el,(o+this._containerShiftIndex)*this.slideWidth),t&&n.slide&&n.slide.resize()})}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){const i=f("pswp__item","div",this.pswp.container);i.setAttribute("role","group"),i.setAttribute("aria-roledescription","slide"),i.setAttribute("aria-hidden","true"),i.style.display=t===1?"block":"none",this.itemHolders.push({el:i})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,i,e){const{pswp:s}=this;let n=s.potentialIndex+t;const o=s.getNumItems();if(s.canLoop()){n=s.getLoopedIndex(n);const h=(t+o)%o;h<=o/2?t=h:t=h-o}else n<0?n=0:n>=o&&(n=o-1),t=n-s.potentialIndex;s.potentialIndex=n,this._currPositionIndex-=t,s.animations.stopMainScroll();const a=this.getCurrSlideX();if(!i)this.moveTo(a),this.updateCurrItem();else{s.animations.startSpring({isMainScroll:!0,start:this.x,end:a,velocity:e||0,naturalFrequency:30,dampingRatio:1,onUpdate:l=>{this.moveTo(l)},onComplete:()=>{this.updateCurrItem(),s.appendHeavy()}});let h=s.potentialIndex-s.currIndex;if(s.canLoop()){const l=(h+o)%o;l<=o/2?h=l:h=l-o}Math.abs(h)>1&&this.updateCurrItem()}return!!t}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;const{pswp:i}=this,e=this._prevPositionIndex-this._currPositionIndex;if(!e)return;this._prevPositionIndex=this._currPositionIndex,i.currIndex=i.potentialIndex;let s=Math.abs(e),n;s>=3&&(this._containerShiftIndex+=e+(e>0?-3:3),s=3);for(let o=0;o0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,y(n.el,(this._containerShiftIndex+2)*this.slideWidth),i.setContent(n,i.currIndex-s+o+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,y(n.el,this._containerShiftIndex*this.slideWidth),i.setContent(n,i.currIndex+s-o-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),i.animations.stopAllPan(),this.itemHolders.forEach((o,a)=>{o.slide&&o.slide.setIsActive(a===1)}),i.currSlide=(t=this.itemHolders[1])===null||t===void 0?void 0:t.slide,i.contentLoader.updateLazy(e),i.currSlide&&i.currSlide.applyCurrentZoomPan(),i.dispatch("change")}moveTo(t,i){if(!this.pswp.canLoop()&&i){let e=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;e+=this.pswp.currIndex;const s=Math.round(t-this.x);(e<0&&s>0||e>=this.pswp.getNumItems()-1&&s<0)&&(t=this.x+s*ct)}this.x=t,this.pswp.container&&y(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:i??!1})}}const pt={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},g=(r,t)=>t?r:pt[r];class ut{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))});const i=document.activeElement;t.on("destroy",()=>{t.options.returnFocus&&i&&this._wasFocused&&i.focus()})}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){const{pswp:i}=this;if(i.dispatch("keydown",{originalEvent:t}).defaultPrevented||G(t))return;let e,s,n=!1;const o="key"in t;switch(o?t.key:t.keyCode){case g("Escape",o):i.options.escKey&&(e="close");break;case g("z",o):e="toggleZoom";break;case g("ArrowLeft",o):s="x";break;case g("ArrowUp",o):s="y";break;case g("ArrowRight",o):s="x",n=!0;break;case g("ArrowDown",o):n=!0,s="y";break;case g("Tab",o):this._focusRoot();break}if(s){t.preventDefault();const{currSlide:a}=i;i.options.arrowKeys&&s==="x"&&i.getNumItems()>1?e=n?"next":"prev":a&&a.currZoomLevel>a.zoomLevels.fit&&(a.pan[s]+=n?-80:80,a.panTo(a.pan.x,a.pan.y))}e&&(t.preventDefault(),i[e]())}_onFocusIn(t){const{template:i}=this.pswp;i&&document!==t.target&&i!==t.target&&!i.contains(t.target)&&i.focus()}}const mt="cubic-bezier(.4,0,.22,1)";class ft{constructor(t){var i;this.props=t;const{target:e,onComplete:s,transform:n,onFinish:o=()=>{},duration:a=333,easing:h=mt}=t;this.onFinish=o;const l=n?"transform":"opacity",c=(i=t[l])!==null&&i!==void 0?i:"";this._target=e,this._onComplete=s,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout(()=>{R(e,l,a,h),this._helperTimeout=setTimeout(()=>{e.addEventListener("transitionend",this._onTransitionEnd,!1),e.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout(()=>{this._finalizeAnimation()},a+500),e.style[l]=c},30)},0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),U(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}const _t=12,vt=.75;class gt{constructor(t,i,e){this.velocity=t*1e3,this._dampingRatio=i||vt,this._naturalFrequency=e||_t,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,i){let e=0,s;i/=1e3;const n=Math.E**(-this._dampingRatio*this._naturalFrequency*i);if(this._dampingRatio===1)s=this.velocity+this._naturalFrequency*t,e=(t+s*i)*n,this.velocity=e*-this._naturalFrequency+s*n;else if(this._dampingRatio<1){s=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);const o=Math.cos(this._dampedFrequency*i),a=Math.sin(this._dampedFrequency*i);e=n*(t*o+s*a),this.velocity=e*-this._naturalFrequency*this._dampingRatio+n*(-this._dampedFrequency*t*a+this._dampedFrequency*s*o)}return e}}class yt{constructor(t){this.props=t,this._raf=0;const{start:i,end:e,velocity:s,onUpdate:n,onComplete:o,onFinish:a=()=>{},dampingRatio:h,naturalFrequency:l}=t;this.onFinish=a;const c=new gt(s,h,l);let d=Date.now(),u=i-e;const m=()=>{this._raf&&(u=c.easeFrame(u,Date.now()-d),Math.abs(u)<1&&Math.abs(c.velocity)<50?(n(e),o&&o(),this.onFinish()):(d=Date.now(),n(u+e),this._raf=requestAnimationFrame(m)))};this._raf=requestAnimationFrame(m)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class wt{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,i){const e=i?new yt(t):new ft(t);return this.activeAnimations.push(e),e.onFinish=()=>this.stop(e),e}stop(t){t.destroy();const i=this.activeAnimations.indexOf(t);i>-1&&this.activeAnimations.splice(i,1)}stopAll(){this.activeAnimations.forEach(t=>{t.destroy()}),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isPan?(t.destroy(),!1):!0)}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isMainScroll?(t.destroy(),!1):!0)}isPanRunning(){return this.activeAnimations.some(t=>t.props.isPan)}}class Pt{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();const{currSlide:i}=this.pswp;let{deltaX:e,deltaY:s}=t;if(i&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(i.isZoomable()){let n=-s;t.deltaMode===1?n*=.05:n*=t.deltaMode?1:.002,n=2**n;const o=i.currZoomLevel*n;i.zoomTo(o,{x:t.clientX,y:t.clientY})}}else i.isPannable()&&(t.deltaMode===1&&(e*=18,s*=18),i.panTo(i.pan.x-e,i.pan.y-s))}}function St(r){if(typeof r=="string")return r;if(!r||!r.isCustomSVG)return"";const t=r;let i='",i}class xt{constructor(t,i){var e;const s=i.name||i.className;let n=i.html;if(t.options[s]===!1)return;typeof t.options[s+"SVG"]=="string"&&(n=t.options[s+"SVG"]),t.dispatch("uiElementCreate",{data:i});let o="";i.isButton?(o+="pswp__button ",o+=i.className||`pswp__button--${i.name}`):o+=i.className||`pswp__${i.name}`;let a=i.isButton?i.tagName||"button":i.tagName||"div";a=a.toLowerCase();const h=f(o,a);if(i.isButton){a==="button"&&(h.type="button");let{title:d}=i;const{ariaLabel:u}=i;typeof t.options[s+"Title"]=="string"&&(d=t.options[s+"Title"]),d&&(h.title=d);const m=u||d;m&&h.setAttribute("aria-label",m)}h.innerHTML=St(n),i.onInit&&i.onInit(h,t),i.onClick&&(h.onclick=d=>{typeof i.onClick=="string"?t[i.onClick]():typeof i.onClick=="function"&&i.onClick(d,h,t)});const l=i.appendTo||"bar";let c=t.element;l==="bar"?(t.topBar||(t.topBar=f("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),c=t.topBar):(h.classList.add("pswp__hide-on-close"),l==="wrapper"&&(c=t.scrollWrap)),(e=c)===null||e===void 0||e.appendChild(t.applyFilters("uiElement",h,i))}}function H(r,t,i){r.classList.add("pswp__button--arrow"),r.setAttribute("aria-controls","pswp__items"),t.on("change",()=>{t.options.loop||(i?r.disabled=!(t.currIndex0))})}const bt={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:H},It={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(r,t)=>{H(r,t,!0)}},At={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-close"},onClick:"close"},Lt={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},Ct={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-loading"},onInit:(r,t)=>{let i,e=null;const s=(a,h)=>{r.classList.toggle("pswp__preloader--"+a,h)},n=a=>{i!==a&&(i=a,s("active",a))},o=()=>{var a;if(!((a=t.currSlide)!==null&&a!==void 0&&a.content.isLoading())){n(!1),e&&(clearTimeout(e),e=null);return}e||(e=setTimeout(()=>{var h;n(!!(!((h=t.currSlide)===null||h===void 0)&&h.content.isLoading())),e=null},t.options.preloaderDelay))};t.on("change",o),t.on("loadComplete",a=>{t.currSlide===a.slide&&o()}),t.ui&&(t.ui.updatePreloaderVisibility=o)}},Tt={name:"counter",order:5,onInit:(r,t)=>{t.on("change",()=>{r.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()})}};function D(r,t){r.classList.toggle("pswp--zoomed-in",t)}class zt{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[At,bt,It,Lt,Ct,Tt],t.dispatch("uiRegister"),this.uiElementsData.sort((i,e)=>(i.order||0)-(e.order||0)),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach(i=>{this.registerElement(i)}),t.on("change",()=>{var i;(i=t.element)===null||i===void 0||i.classList.toggle("pswp--one-slide",t.getNumItems()===1)}),t.on("zoomPanUpdate",()=>this._onZoomPanUpdate())}registerElement(t){this.isRegistered?this.items.push(new xt(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){const{template:t,currSlide:i,options:e}=this.pswp;if(this.pswp.opener.isClosing||!t||!i)return;let{currZoomLevel:s}=i;if(this.pswp.opener.isOpen||(s=i.zoomLevels.initial),s===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=s;const n=i.zoomLevels.initial-i.zoomLevels.secondary;if(Math.abs(n)<.01||!i.isZoomable()){D(t,!1),t.classList.remove("pswp--zoom-allowed");return}t.classList.add("pswp--zoom-allowed");const o=s===i.zoomLevels.initial?i.zoomLevels.secondary:i.zoomLevels.initial;D(t,o<=s),(e.imageClickAction==="zoom"||e.imageClickAction==="zoom-or-close")&&t.classList.add("pswp--click-to-zoom")}}function Et(r){const t=r.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}function Ot(r,t,i){const e=r.getBoundingClientRect(),s=e.width/t,n=e.height/i,o=s>n?s:n,a=(e.width-t*o)/2,h=(e.height-i*o)/2,l={x:e.left+a,y:e.top+h,w:t*o};return l.innerRect={w:e.width,h:e.height,x:a,y:h},l}function Zt(r,t,i){const e=i.dispatch("thumbBounds",{index:r,itemData:t,instance:i});if(e.thumbBounds)return e.thumbBounds;const{element:s}=t;let n,o;if(s&&i.options.thumbSelector!==!1){const a=i.options.thumbSelector||"img";o=s.matches(a)?s:s.querySelector(a)}return o=i.applyFilters("thumbEl",o,t,r),o&&(t.thumbCropped?n=Ot(o,t.width||t.w||0,t.height||t.h||0):n=Et(o)),i.applyFilters("thumbBounds",n,t,r)}class Dt{constructor(t,i){this.type=t,this.defaultPrevented=!1,i&&Object.assign(this,i)}preventDefault(){this.defaultPrevented=!0}}class Mt{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,i,e=100){var s,n,o;this._filters[t]||(this._filters[t]=[]),(s=this._filters[t])===null||s===void 0||s.push({fn:i,priority:e}),(n=this._filters[t])===null||n===void 0||n.sort((a,h)=>a.priority-h.priority),(o=this.pswp)===null||o===void 0||o.addFilter(t,i,e)}removeFilter(t,i){this._filters[t]&&(this._filters[t]=this._filters[t].filter(e=>e.fn!==i)),this.pswp&&this.pswp.removeFilter(t,i)}applyFilters(t,...i){var e;return(e=this._filters[t])===null||e===void 0||e.forEach(s=>{i[0]=s.fn.apply(this,i)}),i[0]}on(t,i){var e,s;this._listeners[t]||(this._listeners[t]=[]),(e=this._listeners[t])===null||e===void 0||e.push(i),(s=this.pswp)===null||s===void 0||s.on(t,i)}off(t,i){var e;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(s=>i!==s)),(e=this.pswp)===null||e===void 0||e.off(t,i)}dispatch(t,i){var e;if(this.pswp)return this.pswp.dispatch(t,i);const s=new Dt(t,i);return(e=this._listeners[t])===null||e===void 0||e.forEach(n=>{n.call(this,s)}),s}}class Rt{constructor(t,i){if(this.element=f("pswp__img pswp__img--placeholder",t?"img":"div",i),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,i){this.element&&(this.element.tagName==="IMG"?(L(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=b(0,0,t/250)):L(this.element,t,i))}destroy(){var t;(t=this.element)!==null&&t!==void 0&&t.parentNode&&this.element.remove(),this.element=null}}class Ft{constructor(t,i,e){this.instance=i,this.data=t,this.index=e,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=_.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(t,i){if(this.slide&&this.usePlaceholder())if(this.placeholder){const e=this.placeholder.element;e&&!e.parentElement&&this.slide.container.prepend(e)}else{const e=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new Rt(e,this.slide.container)}this.element&&!i||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=f("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=f("pswp__content","div"),this.element.innerHTML=this.data.html||""),i&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var i,e;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const s=this.element;this.updateSrcsetSizes(),this.data.srcset&&(s.srcset=this.data.srcset),s.src=(i=this.data.src)!==null&&i!==void 0?i:"",s.alt=(e=this.data.alt)!==null&&e!==void 0?e:"",this.state=_.LOADING,s.complete?this.onLoaded():(s.onload=()=>{this.onLoaded()},s.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=_.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===_.LOADED||this.state===_.ERROR)&&this.removePlaceholder())}onError(){this.state=_.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===_.LOADING,this)}isError(){return this.state===_.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(t,i){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,i),!this.instance.dispatch("contentResize",{content:this,width:t,height:i}).defaultPrevented&&(L(this.element,t,i),this.isImageContent()&&!this.isError()))){const e=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=i,e?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:i,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==_.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,i=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||i>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=i+"px",t.dataset.largestUsedSize=String(i))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,i;let e=f("pswp__error-msg","div");e.innerText=(t=(i=this.instance.options)===null||i===void 0?void 0:i.errorMsg)!==null&&t!==void 0?t:"",e=this.instance.applyFilters("contentErrorElement",e,this),this.element=f("pswp__content pswp__error-msg-container","div"),this.element.appendChild(e),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===_.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||C())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!C()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===_.LOADED||this.state===_.ERROR)&&this.removePlaceholder()))}}const Bt=5;function W(r,t,i){const e=t.createContentFromData(r,i);let s;const{options:n}=t;if(n){s=new k(n,r,-1);let o;t.pswp?o=t.pswp.viewportSize:o=B(n,t);const a=N(n,o,r,i);s.update(e.width,e.height,a)}return e.lazyLoad(),s&&e.setDisplayedSize(Math.ceil(e.width*s.initial),Math.ceil(e.height*s.initial)),e}function Nt(r,t){const i=t.getItemData(r);if(!t.dispatch("lazyLoadSlide",{index:r,itemData:i}).defaultPrevented)return W(i,t,r)}class kt{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,Bt),this._cachedItems=[]}updateLazy(t){const{pswp:i}=this;if(i.dispatch("lazyLoad").defaultPrevented)return;const{preload:e}=i.options,s=t===void 0?!0:t>=0;let n;for(n=0;n<=e[1];n++)this.loadSlideByIndex(i.currIndex+(s?n:-n));for(n=1;n<=e[0];n++)this.loadSlideByIndex(i.currIndex+(s?-n:n))}loadSlideByIndex(t){const i=this.pswp.getLoopedIndex(t);let e=this.getContentByIndex(i);e||(e=Nt(i,this.pswp),e&&this.addToCache(e))}getContentBySlide(t){let i=this.getContentByIndex(t.index);return i||(i=this.pswp.createContentFromData(t.data,t.index),this.addToCache(i)),i.setSlide(t),i}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){const i=this._cachedItems.findIndex(e=>!e.isAttached&&!e.hasSlide);i!==-1&&this._cachedItems.splice(i,1)[0].destroy()}}removeByIndex(t){const i=this._cachedItems.findIndex(e=>e.index===t);i!==-1&&this._cachedItems.splice(i,1)}getContentByIndex(t){return this._cachedItems.find(i=>i.index===t)}destroy(){this._cachedItems.forEach(t=>t.destroy()),this._cachedItems=[]}}class Ht extends Mt{getNumItems(){var t;let i=0;const e=(t=this.options)===null||t===void 0?void 0:t.dataSource;e&&"length"in e?i=e.length:e&&"gallery"in e&&(e.items||(e.items=this._getGalleryDOMElements(e.gallery)),e.items&&(i=e.items.length));const s=this.dispatch("numItems",{dataSource:e,numItems:i});return this.applyFilters("numItems",s.numItems,e)}createContentFromData(t,i){return new Ft(t,this,i)}getItemData(t){var i;const e=(i=this.options)===null||i===void 0?void 0:i.dataSource;let s={};Array.isArray(e)?s=e[t]:e&&"gallery"in e&&(e.items||(e.items=this._getGalleryDOMElements(e.gallery)),s=e.items[t]);let n=s;n instanceof Element&&(n=this._domElementToItemData(n));const o=this.dispatch("itemData",{itemData:n||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var i,e;return(i=this.options)!==null&&i!==void 0&&i.children||(e=this.options)!==null&&e!==void 0&&e.childSelector?K(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const i={element:t},e=t.tagName==="A"?t:t.querySelector("a");if(e){i.src=e.dataset.pswpSrc||e.href,e.dataset.pswpSrcset&&(i.srcset=e.dataset.pswpSrcset),i.width=e.dataset.pswpWidth?parseInt(e.dataset.pswpWidth,10):0,i.height=e.dataset.pswpHeight?parseInt(e.dataset.pswpHeight,10):0,i.w=i.width,i.h=i.height,e.dataset.pswpType&&(i.type=e.dataset.pswpType);const n=t.querySelector("img");if(n){var s;i.msrc=n.currentSrc||n.src,i.alt=(s=n.getAttribute("alt"))!==null&&s!==void 0?s:""}(e.dataset.pswpCropped||e.dataset.cropped)&&(i.thumbCropped=!0)}return this.applyFilters("domItemData",i,t,e)}lazyLoadData(t,i){return W(t,this,i)}}const P=.003;class Wt{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout(()=>{this._start()},this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){const t=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:t}=this,i=this.pswp.currSlide,{options:e}=t;if(e.showHideAnimationType==="fade"?(e.showHideOpacity=!0,this._thumbBounds=void 0):e.showHideAnimationType==="none"?(e.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=i==null?void 0:i.getPlaceholderElement(),t.animations.stopAll(),this._useAnimation=!!(this._duration&&this._duration>50),this._animateZoom=!!this._thumbBounds&&(i==null?void 0:i.content.usePlaceholder())&&(!this.isClosing||!t.mainScroll.isShifted()),!this._animateZoom)this._animateRootOpacity=!0,this.isOpening&&i&&(i.zoomAndPanToInitial(),i.applyCurrentZoomPan());else{var s;this._animateRootOpacity=(s=e.showHideOpacity)!==null&&s!==void 0?s:!1}if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>P,this._opacityElement=this._animateRootOpacity?t.element:t.bg,!this._useAnimation){this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,this.isOpening&&(t.element&&(t.element.style.opacity=String(P)),t.applyBgOpacity(1));return}if(this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect){var n;this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=(n=this.pswp.currSlide)===null||n===void 0?void 0:n.holderElement,t.container&&(t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px")}else this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(t.element&&(t.element.style.opacity=String(P)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(P)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(P)))):this.isClosing&&(t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none"),t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&t.mainScroll.x!==0&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&this._placeholder.tagName==="IMG"?new Promise(t=>{let i=!1,e=!0;q(this._placeholder).finally(()=>{i=!0,e||t(!0)}),setTimeout(()=>{e=!1,i&&t(!0)},50),setTimeout(t,250)}).finally(()=>this._initiate()):this._initiate()}_initiate(){var t,i;(t=this.pswp.element)===null||t===void 0||t.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),(i=this.pswp.element)===null||i===void 0||i.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:t}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)t.destroy();else if(this.isOpen){var i;this._animateZoom&&t.container&&(t.container.style.overflow="visible",t.container.style.width="100%"),(i=t.currSlide)===null||i===void 0||i.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:t}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),t.currSlide&&(t.currSlide.zoomAndPanToInitial(),this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform()))),this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity)),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){const{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0"),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}_setClosedStateZoomPan(t){if(!this._thumbBounds)return;const{pswp:i}=this,{innerRect:e}=this._thumbBounds,{currSlide:s,viewportSize:n}=i;if(this._croppedZoom&&e&&this._cropContainer1&&this._cropContainer2){const o=-n.x+(this._thumbBounds.x-e.x)+e.w,a=-n.y+(this._thumbBounds.y-e.y)+e.h,h=n.x-e.w,l=n.y-e.h;t?(this._animateTo(this._cropContainer1,"transform",b(o,a)),this._animateTo(this._cropContainer2,"transform",b(h,l))):(y(this._cropContainer1,o,a),y(this._cropContainer2,h,l))}s&&(p(s.pan,e||this._thumbBounds),s.currZoomLevel=this._thumbBounds.w/s.width,t?this._animateTo(s.container,"transform",s.getCurrentTransform()):s.applyCurrentZoomPan())}_animateTo(t,i,e){if(!this._duration){t.style[i]=e;return}const{animations:s}=this.pswp,n={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{s.activeAnimations.length||this._onAnimationComplete()},target:t};n[i]=e,s.startTransition(n)}}const Vt={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class $t extends Ht{constructor(t){super(),this.options=this._prepareOptions(t||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new X,this.animations=new wt,this.mainScroll=new dt(this),this.gestures=new lt(this),this.opener=new Wt(this),this.keyboard=new ut(this),this.contentLoader=new kt(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+t),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new Pt(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",()=>{const{itemHolders:i}=this.mainScroll;i[0]&&(i[0].el.style.display="block",this.setContent(i[0],this.currIndex-1)),i[2]&&(i[2].el.style.display="block",this.setContent(i[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")}),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const i=this.getNumItems();return this.options.loop&&(t>i-1&&(t-=i),t<0&&(t+=i)),I(t,0,i-1)}appendHeavy(){this.mainScroll.itemHolders.forEach(t=>{var i;(i=t.slide)===null||i===void 0||i.appendHeavy()})}goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){var i;(i=this.currSlide)===null||i===void 0||i.zoomTo(...t)}toggleZoom(){var t;(t=this.currSlide)===null||t===void 0||t.toggleZoom()}close(){!this.opener.isOpen||this.isDestroying||(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var t;if(!this.isDestroying){this.options.showHideAnimationType="none",this.close();return}this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),(t=this.element)===null||t===void 0||t.remove(),this.mainScroll.itemHolders.forEach(i=>{var e;(e=i.slide)===null||e===void 0||e.destroy()}),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(t){this.contentLoader.removeByIndex(t),this.mainScroll.itemHolders.forEach((i,e)=>{var s,n;let o=((s=(n=this.currSlide)===null||n===void 0?void 0:n.index)!==null&&s!==void 0?s:0)-1+e;if(this.canLoop()&&(o=this.getLoopedIndex(o)),o===t&&(this.setContent(i,t,!0),e===1)){var a;this.currSlide=i.slide,(a=i.slide)===null||a===void 0||a.setIsActive(!0)}}),this.dispatch("change")}setContent(t,i,e){if(this.canLoop()&&(i=this.getLoopedIndex(i)),t.slide){if(t.slide.index===i&&!e)return;t.slide.destroy(),t.slide=void 0}if(!this.canLoop()&&(i<0||i>=this.getNumItems()))return;const s=this.getItemData(i);t.slide=new j(s,i,this),i===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const i=B(this.options,this);!t&&x(i,this._prevViewportSize)||(p(this._prevViewportSize,i),this.dispatch("beforeResize"),p(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){if(!this.hasMouse){var t;this.hasMouse=!0,(t=this.element)===null||t===void 0||t.classList.add("pswp--has_mouse")}}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout(()=>{this.updateSize()},500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,i){this.offset.x=t,this.offset.y=i,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=f("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=f("pswp__bg","div",this.element),this.scrollWrap=f("pswp__scroll-wrap","section",this.element),this.container=f("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new zt(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return Zt(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(t){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),{...Vt,...t}}}export{$t as default}; diff --git a/assets/plugin-vue_export-helper-x3n3nnut.js b/assets/plugin-vue_export-helper-x3n3nnut.js new file mode 100644 index 00000000..718edd33 --- /dev/null +++ b/assets/plugin-vue_export-helper-x3n3nnut.js @@ -0,0 +1 @@ +const s=(t,r)=>{const o=t.__vccOpts||t;for(const[c,e]of r)o[c]=e;return o};export{s as _}; diff --git a/assets/qh4efq-HCV-SN0f.png b/assets/qh4efq-HCV-SN0f.png new file mode 100644 index 00000000..641db3a1 Binary files /dev/null and b/assets/qh4efq-HCV-SN0f.png differ diff --git "a/assets/redis\347\274\223\345\255\230.html-B4MmbAQF.js" "b/assets/redis\347\274\223\345\255\230.html-B4MmbAQF.js" new file mode 100644 index 00000000..1faa0f41 --- /dev/null +++ "b/assets/redis\347\274\223\345\255\230.html-B4MmbAQF.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-70796e0a","path":"/redis/redis%E7%BC%93%E5%AD%98.html","title":"一、概述","lang":"zh-CN","frontmatter":{"description":"一、概述 1.1 缓存介绍 系统的性能指标一般包括响应时间、延迟时间、吞吐量,并发用户数和资源利用率等。在应用运行过程中,我们有可能在一次数据库会话中,执行多次查询条件完全相同的SQL,MyBatis提供了一级缓存的方案优化这部分场景,如果是相同的SQL语句,会优先命中一级缓存,避免直接对数据库进行查询,提高性能。 缓存常用语: 数据不一致性、缓存更新机制、缓存可用性、缓存服务降级、缓存预热、缓存穿透 可查看Redis实战(一) 使用缓存合理性","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/redis/redis%E7%BC%93%E5%AD%98.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"一、概述"}],["meta",{"property":"og:description","content":"一、概述 1.1 缓存介绍 系统的性能指标一般包括响应时间、延迟时间、吞吐量,并发用户数和资源利用率等。在应用运行过程中,我们有可能在一次数据库会话中,执行多次查询条件完全相同的SQL,MyBatis提供了一级缓存的方案优化这部分场景,如果是相同的SQL语句,会优先命中一级缓存,避免直接对数据库进行查询,提高性能。 缓存常用语: 数据不一致性、缓存更新机制、缓存可用性、缓存服务降级、缓存预热、缓存穿透 可查看Redis实战(一) 使用缓存合理性"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T11:34:08.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T11:34:08.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"一、概述\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T11:34:08.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"1.1 缓存介绍","slug":"_1-1-缓存介绍","link":"#_1-1-缓存介绍","children":[]},{"level":2,"title":"1.2 本站缓存架构","slug":"_1-2-本站缓存架构","link":"#_1-2-本站缓存架构","children":[]},{"level":2,"title":"2.1 mybatis一级缓存","slug":"_2-1-mybatis一级缓存","link":"#_2-1-mybatis一级缓存","children":[]},{"level":2,"title":"2.2 mybatis二级缓存","slug":"_2-2-mybatis二级缓存","link":"#_2-2-mybatis二级缓存","children":[{"level":3,"title":"2.2.1 MyBatis二级缓存的划分","slug":"_2-2-1-mybatis二级缓存的划分","link":"#_2-2-1-mybatis二级缓存的划分","children":[]},{"level":3,"title":"2.2.2 二级缓存的开启","slug":"_2-2-2-二级缓存的开启","link":"#_2-2-2-二级缓存的开启","children":[]},{"level":3,"title":"2.2.3 使用第三方支持的二级缓存的实现","slug":"_2-2-3-使用第三方支持的二级缓存的实现","link":"#_2-2-3-使用第三方支持的二级缓存的实现","children":[]}]},{"level":2,"title":"2.3 Mybatis在分布式环境下脏读问题","slug":"_2-3-mybatis在分布式环境下脏读问题","link":"#_2-3-mybatis在分布式环境下脏读问题","children":[]},{"level":2,"title":"3.1 Spring Cache","slug":"_3-1-spring-cache","link":"#_3-1-spring-cache","children":[]},{"level":2,"title":"3.2 引入包","slug":"_3-2-引入包","link":"#_3-2-引入包","children":[]},{"level":2,"title":"3.3 ApplicationContext.xml","slug":"_3-3-applicationcontext-xml","link":"#_3-3-applicationcontext-xml","children":[]},{"level":2,"title":"3.5 自定义KeyGenerator","slug":"_3-5-自定义keygenerator","link":"#_3-5-自定义keygenerator","children":[]},{"level":2,"title":"3.4 添加注解","slug":"_3-4-添加注解","link":"#_3-4-添加注解","children":[]},{"level":2,"title":"3.5 测试","slug":"_3-5-测试","link":"#_3-5-测试","children":[]},{"level":2,"title":"3.6 实验结果","slug":"_3-6-实验结果","link":"#_3-6-实验结果","children":[]},{"level":2,"title":"3.7 分页的数据怎么办","slug":"_3-7-分页的数据怎么办","link":"#_3-7-分页的数据怎么办","children":[]}],"git":{"createdTime":1706066758000,"updatedTime":1706096048000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":3}]},"readingTime":{"minutes":11.96,"words":3588},"filePathRelative":"redis/redis缓存.md","localizedDate":"2024年1月24日","excerpt":"

一、概述

\\n

1.1 缓存介绍

\\n

系统的性能指标一般包括响应时间、延迟时间、吞吐量,并发用户数和资源利用率等。在应用运行过程中,我们有可能在一次数据库会话中,执行多次查询条件完全相同的SQL,MyBatis提供了一级缓存的方案优化这部分场景,如果是相同的SQL语句,会优先命中一级缓存,避免直接对数据库进行查询,提高性能。
\\n缓存常用语:
\\n数据不一致性、缓存更新机制、缓存可用性、缓存服务降级、缓存预热、缓存穿透
\\n可查看Redis实战(一) 使用缓存合理性

","autoDesc":true}');export{e as data}; diff --git "a/assets/redis\347\274\223\345\255\230.html-iW7cH3sc.js" "b/assets/redis\347\274\223\345\255\230.html-iW7cH3sc.js" new file mode 100644 index 00000000..2e7eb261 --- /dev/null +++ "b/assets/redis\347\274\223\345\255\230.html-iW7cH3sc.js" @@ -0,0 +1,93 @@ +import{_ as p}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as c,c as l,a as n,d as a,b as t,e}from"./app-hbwtiwmf.js";const i={},u=n("h1",{id:"一、概述",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#一、概述","aria-hidden":"true"},"#"),a(" 一、概述")],-1),r=n("h2",{id:"_1-1-缓存介绍",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#_1-1-缓存介绍","aria-hidden":"true"},"#"),a(" 1.1 缓存介绍")],-1),k=n("br",null,null,-1),d=n("br",null,null,-1),m=n("br",null,null,-1),g={href:"http://blog.csdn.net/diyhzp/article/details/54892358",target:"_blank",rel:"noopener noreferrer"},h=e(`

1.2 本站缓存架构

从没有使用缓存,到使用mybatis缓存,然后使用了ehcache,再然后是mybatis+redis缓存。

步骤:
(1)用户发送一个请求到nginx,nginx对请求进行分发。
(2)请求进入controller,service,service中查询缓存,如果命中,则直接返回结果,否则去调用mybatis。
(3)mybatis的缓存调用步骤:二级缓存->一级缓存->直接查询数据库。
(4)查询数据库的时候,mysql作了主主备份。

二、Mybatis缓存

2.1 mybatis一级缓存

Mybatis的一级缓存是指Session回话级别的缓存,也称作本地缓存。一级缓存的作用域是一个SqlSession。Mybatis默认开启一级缓存。在同一个SqlSession中,执行相同的查询SQL,第一次会去查询数据库,并写到缓存中;第二次直接从缓存中取。当执行SQL时两次查询中间发生了增删改操作,则SqlSession的缓存清空。Mybatis 默认支持一级缓存,不需要在配置文件中配置。

我们来查看一下源码的类图,具体的源码分析简单概括一下:SqlSession实际上是使用PerpetualCache来维护的,PerpetualCache中定义了一个HashMap来进行缓存。
(1)当会话开始时,会创建一个新的SqlSession对象,SqlSession对象中会有一个新的Executor对象,Executor对象中持有一个新的PerpetualCache对象;
(2)对于某个查询,根据statementId,params,rowBounds来构建一个key值,根据这个key值去缓存Cache中取出对应的key值存储的缓存结果。如果命中,则返回结果,如果没有命中,则去数据库中查询,再将结果存储到cache中,最后返回结果。如果执行增删改,则执行flushCacheIfRequired方法刷新缓存。
(3)当会话结束时,SqlSession对象及其内部的Executor对象还有PerpetualCache对象也一并释放掉。

2.2 mybatis二级缓存

Mybatis的二级缓存是指mapper映射文件,为Application应用级别的缓存,生命周期长。二级缓存的作用域是同一个namespace下的mapper映射文件内容,多个SqlSession共享。Mybatis需要手动设置启动二级缓存。在同一个namespace下的mapper文件中,执行相同的查询SQL。实现二级缓存,关键是要对Executor对象做文章,Mybatis给Executor对象加上了一个CachingExecutor,使用了设计模式中的装饰者模式,

2.2.1 MyBatis二级缓存的划分

MyBatis并不是简单地对整个Application就只有一个Cache缓存对象,它将缓存划分的更细,即是Mapper级别的,即每一个Mapper都可以拥有一个Cache对象,具体如下:
a.为每一个Mapper分配一个Cache缓存对象;
b.多个Mapper共用一个Cache缓存对象;

2.2.2 二级缓存的开启

在mybatis的配置文件中添加:

<settings>
+   <!--开启二级缓存-->
+    <setting name="cacheEnabled" value="true"/>
+</settings>
+

然后再需要开启二级缓存的mapper.xml中添加(本站使用了LRU算法,时间为120000毫秒):

    <cache eviction="LRU"
+           type="org.apache.ibatis.cache.impl.PerpetualCache"
+           flushInterval="120000"
+           size="1024"
+           readOnly="true"/>
+

2.2.3 使用第三方支持的二级缓存的实现

MyBatis对二级缓存的设计非常灵活,它自己内部实现了一系列的Cache缓存实现类,并提供了各种缓存刷新策略如LRU,FIFO等等;另外,MyBatis还允许用户自定义Cache接口实现,用户是需要实现org.apache.ibatis.cache.Cache接口,然后将Cache实现类配置在节点的type属性上即可;除此之外,MyBatis还支持跟第三方内存缓存库如Memecached、Redis的集成,总之,使用MyBatis的二级缓存有三个选择:

`,22),v=n("li",null,"MyBatis自身提供的缓存实现;",-1),b=n("li",null,"用户自定义的Cache接口实现;",-1),y=n("br",null,null,-1),q={href:"http://blog.csdn.net/xiadi934/article/details/50786293",target:"_blank",rel:"noopener noreferrer"},f={href:"http://blog.csdn.net/luanlouis/article/details/41390801",target:"_blank",rel:"noopener noreferrer"},_=e(`

2.3 Mybatis在分布式环境下脏读问题

(1)如果是一级缓存,在多个SqlSession或者分布式的环境下,数据库的写操作会引起脏数据,多数情况可以通过设置缓存级别为Statement来解决。
(2)如果是二级缓存,虽然粒度比一级缓存更细,但是在进行多表查询时,依旧可能会出现脏数据。
(3)Mybatis的缓存默认是本地的,分布式环境下出现脏读问题是不可避免的,虽然可以通过实现Mybatis的Cache接口,但还不如直接使用集中式缓存如Redis、Memcached好。

下面将介绍使用Redis集中式缓存在个人网站的应用。

三、Redis缓存

Redis运行于独立的进程,通过网络协议和应用交互,将数据保存在内存中,并提供多种手段持久化内存的数据。同时具备服务器的水平拆分、复制等分布式特性,使得其成为缓存服务器的主流。为了与Spring更好的结合使用,我们使用的是Spring-Data-Redis。此处省略安装过程和Redis的命令讲解。

3.1 Spring Cache

Spring 3.1 引入了激动人心的基于注释(annotation)的缓存(cache)技术,它本质上不是一个具体的缓存实现方案(例如EHCache 或者 OSCache),而是一个对缓存使用的抽象,通过在既有代码中添加少量它定义的各种 annotation,即能够达到缓存方法的返回对象的效果。Spring 的缓存技术还具备相当的灵活性,不仅能够使用 **SpEL(Spring Expression Language)**来定义缓存的 key 和各种 condition,还提供开箱即用的缓存临时存储方案,也支持和主流的专业缓存例如 EHCache 集成。
下面是Spring Cache常用的注解:

(1)@Cacheable
@Cacheable 的作用 主要针对方法配置,能够根据方法的请求参数对其结果进行缓存

属性介绍例子
value缓存的名称,必选@Cacheable(value=”mycache”) 或者@Cacheable(value={”cache1”,”cache2”}
key缓存的key,可选,需要按照SpEL表达式填写@Cacheable(value=”testcache”,key=”#userName”)
condition缓存的条件,可以为空,使用 SpEL 编写,只有为 true 才进行缓存@Cacheable(value=”testcache”,key=”#userName”)

(2)@CachePut
@CachePut 的作用 主要针对方法配置,能够根据方法的请求参数对其结果进行缓存,和 @Cacheable 不同的是,它每次都会触发真实方法的调用

属性介绍例子
value缓存的名称,必选@Cacheable(value=”mycache”) 或者@Cacheable(value={”cache1”,”cache2”}
key缓存的key,可选,需要按照SpEL表达式填写@Cacheable(value=”testcache”,key=”#userName”)
condition缓存的条件,可以为空,使用 SpEL 编写,只有为 true 才进行缓存@Cacheable(value=”testcache”,key=”#userName”)

(3)@CacheEvict
@CachEvict 的作用 主要针对方法配置,能够根据一定的条件对缓存进行清空

属性介绍例子
value缓存的名称,必选@Cacheable(value=”mycache”) 或者@Cacheable(value={”cache1”,”cache2”}
key缓存的key,可选,需要按照SpEL表达式填写@Cacheable(value=”testcache”,key=”#userName”)
condition缓存的条件,可以为空,使用 SpEL 编写,只有为 true 才进行缓存@Cacheable(value=”testcache”,key=”#userName”)
allEntries是否清空所有缓存内容,默认为false@CachEvict(value=”testcache”,allEntries=true)
beforeInvocation是否在方法执行前就清空,缺省为 false@CachEvict(value=”testcache”,beforeInvocation=true)

但是有个问题:
Spring官方认为:缓存过期时间由各个产商决定,所以并不提供缓存过期时间的注解。所以,如果想实现各个元素过期时间不同,就需要自己重写一下Spring cache。

3.2 引入包

一般是Spring常用的包+Spring data redis的包,记得注意去掉所有冲突的包,之前才过坑,Spring-data-MongoDB已经有SpEL的库了,和自己新引进去的冲突,搞得我以为自己是配置配错了,真是个坑,注意,开发过程中一定要去除掉所有冲突的包!!!

3.3 ApplicationContext.xml

需要启用缓存的注解开关,并配置好Redis。序列化方式也要带上,否则会碰到幽灵bug。

    <!-- 启用缓存注解开关,此处可自定义keyGenerator -->
+    <cache:annotation-driven/>
+    <bean id="jedisConnectionFactory"
+          class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
+        <property name="hostName" value="\${host}"/>
+        <property name="port" value="\${port}"/>
+        <property name="password" value="\${password}"/>
+        <property name="database" value="\${redis.default.db}"/>
+        <property name="timeout" value="\${timeout}"/>
+        <property name="poolConfig" ref="jedisPoolConfig"/>
+        <property name="usePool" value="true"/>
+    </bean>
+    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
+        <property name="connectionFactory" ref="jedisConnectionFactory"/>
+        <!-- 序列化方式 建议key/hashKey采用StringRedisSerializer。 -->
+        <property name="keySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="hashKeySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="valueSerializer">
+            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
+        </property>
+        <property name="hashValueSerializer">
+            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
+        </property>
+    </bean>
+    <bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
+        <constructor-arg name="redisOperations" ref="redisTemplate" />
+        <!--统一过期时间-->
+        <property name="defaultExpiration" value="\${redis.defaultExpiration}"/>
+    </bean>
+

3.5 自定义KeyGenerator

在分布式系统中,很容易存在不同类相同名字的方法,如A.getAll(),B.getAll(),默认的key(getAll)都是一样的,会很容易产生问题,所以,需要自定义key来实现分布式环境下的不同。

@Component("customKeyGenerator")
+public class CustomKeyGenerator implements KeyGenerator {
+    @Override
+    public Object generate(Object o, Method method, Object... objects) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(o.getClass().getName());
+        sb.append(".");
+        sb.append(method.getName());
+        for (Object obj : objects) {
+            sb.append(obj.toString());
+        }
+        return sb.toString();
+    }
+}
+

之后,存储的key就变为:com.myblog.service.impl.BlogServiceImpl.getBanner。

3.4 添加注解

在所需要的方法上添加注解,比如,首页中的那几张幻灯片,每次进入首页都需要查询数据库,这里,我们直接放入缓存里,减少数据库的压力,还有就是那些热门文章,访问量比较大的,也放进数据库里。

    @Override
+    @Cacheable(value = "getBanner", keyGenerator = "customKeyGenerator")
+    public List<Blog> getBanner() {
+        return blogMapper.getBanner();
+    }
+    @Override
+    @Cacheable(value = "getBlogDetail", key = "'blogid'.concat(#blogid)")
+    public Blog getBlogDetail(Integer blogid) {
+        Blog blog = blogMapper.selectByPrimaryKey(blogid);
+        if (blog == null) {
+            return null;
+        }
+        Category category = categoryMapper.selectByPrimaryKey(blog.getCategoryid());
+        blog.setCategory(category);
+        List<Tag> tags = tagMapper.getTagByBlogId(blog.getBlogid());
+        blog.setTags(tags.size() > 0 ? tags : null);
+        asyncService.updatebloghits(blogid);//异步更新阅读次数
+        logger.info("没有走缓存");
+        return blog;
+    }
+

3.5 测试

我们调用一个getBlogDetail(获取博客详情)100次来对比一下时间。连接的数据库在深圳,本人在广州,还是有那么一丢丢的网路延时的。

public class SpringTest {
+    @Test
+    public void init() {
+        ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath:spring-test.xml");
+        IBlogService blogService = (IBlogService) ctx.getBean("blogService");
+        long startTime = System.currentTimeMillis();
+        for (int i = 0; i < 100; i++) {
+            blogService.getBlogDetail(615);
+        }
+        System.out.println(System.currentTimeMillis() - startTime);
+    }
+}
+

为了做一下对比,我们同时使用mybatis自身缓存来进行测试。

3.6 实验结果

统计出结果如下:

没有使用任何缓存(mybatis一级缓存没有关闭):18305
+使用远程Redis缓存:12727
+使用Mybatis缓存:6649
+使用本地Redis缓存:5818
+

由结果看出,缓存的使用大大较少了获取数据的时间。

部署进个人博客之后,redis已经缓存的数据:

3.7 分页的数据怎么办

个人网站中共有两个栏目,一个是技术杂谈,另一个是生活笔记,每点击一次栏目的时候,会根据页数从数据库中查询数据,百度了下,大概有三种方法:
(1)以页码作为Key,然后缓存整个页面。
(2)分条存取,只从数据库中获取分页的文章ID序列,然后从service(缓存策略在service中实现)中获取。
第一种,由于使用了第三方的插件PageHelper,分页获取的话会比较麻烦,同时整页缓存对内存压力也蛮大的,毕竟服务器只有2g。第二条实现方式简单,缺陷是依旧需要查询数据库,想了想还是放弃了。缓存的初衷是对请求频繁又不易变的数据,实际使用中很少会反复的请求同一页的数据(查询条件也相同),当然对数据中某些字段做缓存还是有必要的。

四、如何解决脏读?

`,40),S={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},x=n("h1",{id:"五、题外话",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#五、题外话","aria-hidden":"true"},"#"),a(" 五、题外话")],-1),C=n("p",null,"兄弟姐妹们啊,个人网站只是个小项目,纯属为了学习而用的,文章可以看看,但是,就不要抓取了吧。。。。一个小时抓取6万次宝宝心脏真的受不了,虽然服务器一切都还稳定==",-1),w=n("figure",null,[n("img",{src:"http://image.wenzhihuai.com/images/20180119044345.png",alt:"",tabindex:"0"}),n("figcaption")],-1),M=n("strong",null,"个人网站",-1),B={href:"http://www.wenzhihuai.com",target:"_blank",rel:"noopener noreferrer"},z=n("br",null,null,-1),E=n("strong",null,"个人网站源码,希望能给个star",-1),R={href:"https://github.com/Zephery/newblog",target:"_blank",rel:"noopener noreferrer"},j=n("br",null,null,-1),L={href:"http://blog.csdn.net/luanlouis/article/details/41390801",target:"_blank",rel:"noopener noreferrer"},I=n("br",null,null,-1),N={href:"http://blog.csdn.net/luanlouis/article/details/41408341",target:"_blank",rel:"noopener noreferrer"},T=n("br",null,null,-1),P={href:"https://mp.weixin.qq.com/s/Ju4d71VrL0omGkV3s3U_1Q",target:"_blank",rel:"noopener noreferrer"},O=n("br",null,null,-1),K={href:"https://www.jianshu.com/p/0b00cbba40f3",target:"_blank",rel:"noopener noreferrer"},A=n("br",null,null,-1),V={href:"http://blog.csdn.net/xiadi934/article/details/50786293",target:"_blank",rel:"noopener noreferrer"},D=n("br",null,null,-1);function G(F,Q){const s=o("ExternalLinkIcon");return c(),l("div",null,[u,r,n("p",null,[a("系统的性能指标一般包括响应时间、延迟时间、吞吐量,并发用户数和资源利用率等。在应用运行过程中,我们有可能在一次数据库会话中,执行多次查询条件完全相同的SQL,MyBatis提供了一级缓存的方案优化这部分场景,如果是相同的SQL语句,会优先命中一级缓存,避免直接对数据库进行查询,提高性能。"),k,a(" 缓存常用语:"),d,a(" 数据不一致性、缓存更新机制、缓存可用性、缓存服务降级、缓存预热、缓存穿透"),m,a(" 可查看"),n("a",g,[a("Redis实战(一) 使用缓存合理性"),t(s)])]),h,n("ol",null,[v,b,n("li",null,[a("跟第三方内存缓存库的集成;"),y,a(" 具体的实现,可参照:"),n("a",q,[a("SpringMVC + MyBatis + Mysql + Redis(作为二级缓存) 配置"),t(s)])])]),n("p",null,[a("MyBatis中一级缓存和二级缓存的组织如下图所示(图片来自"),n("a",f,[a("深入理解mybatis原理"),t(s)]),a("):")]),_,n("p",null,[a("对于文章来说,内容是不经常更新的,没有涉及到缓存一致性,但是对于文章的阅读量,用户每点击一次,就应该更新浏览量的。对于文章的缓存,常规的设计是将文章存储进数据库中,然后读取的时候放入缓存中,然后将浏览量以文章ID+浏览量的结构实时的存入redis服务器中。本站当初设计不合理,直接将浏览量作为一个字段,用户每点击一次的时候就异步更新浏览量,但是此处没有更新缓存,如果手动更新缓存的话,基本上每点击一次都得执行更新操作,同样也不合理。所以,目前本站,你们在页面上看到的浏览量和数据库中的浏览量并不是一致的。有兴趣的可以点击"),n("a",S,[a("我的网站"),t(s)]),a("玩玩~~")]),x,C,w,n("p",null,[M,a(":"),n("a",B,[a("http://www.wenzhihuai.com"),t(s)]),z,E,a(":"),n("a",R,[a("https://github.com/Zephery/newblog"),t(s)])]),n("p",null,[a("参考:"),j,a(" 1."),n("a",L,[a("《深入理解mybatis原理》 MyBatis的一级缓存实现详解"),t(s)]),I,a(" 2."),n("a",N,[a("《深入理解mybatis原理》 MyBatis的二级缓存的设计原理"),t(s)]),T,a(" 3."),n("a",P,[a("聊聊Mybatis缓存机制"),t(s)]),O,a(" 4."),n("a",K,[a("Spring思维导图"),t(s)]),A,a(" 5."),n("a",V,[a("SpringMVC + MyBatis + Mysql + Redis(作为二级缓存) 配置"),t(s)]),D,a(" 6.《深入分布式缓存:从原理到实践》")])])}const J=p(i,[["render",G],["__file","redis缓存.html.vue"]]);export{J as default}; diff --git a/assets/serverlog.html-IiWshuB0.js b/assets/serverlog.html-IiWshuB0.js new file mode 100644 index 00000000..7544bbb5 --- /dev/null +++ b/assets/serverlog.html-IiWshuB0.js @@ -0,0 +1,3 @@ +import{_ as n}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as s,o,c,a as e,d as a,b as i,e as r}from"./app-hbwtiwmf.js";const p={},h=r('

被挖矿攻击

服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看:

stratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG

使用top查看:

',5),l={href:"http://www.setphp.com/981.html",target:"_blank",rel:"noopener noreferrer"},d=e("br",null,null,-1),m={href:"http://www.setphp.com/981.html",target:"_blank",rel:"noopener noreferrer"},g=r(`
iptables -A INPUT -s xmr.crypto-pool.fr -j DROP
+iptables -A OUTPUT -d xmr.crypto-pool.fr -j DROP
+

2017-10-02 再次遭到挖矿攻击

2017-11-20

19号添加mongodb之后,20号重启了服务器,但是忘记启动mongodb,导致后台一直在重连mongodb,也就导致了服务访问超级超级慢,记住要启动所需要的组件。

2017-12-03

2017-12-05 wipefs

`,8);function f(b,u){const t=s("ExternalLinkIcon");return o(),c("div",null,[h,e("p",null,[a("启动iptables,参考"),e("a",l,[a("http://www.setphp.com/981.html"),i(t)]),d,e("a",m,[a("http://www.setphp.com/981.html"),i(t)])]),g])}const v=n(p,[["render",f],["__file","serverlog.html.vue"]]);export{v as default}; diff --git a/assets/serverlog.html-ib9svlbN.js b/assets/serverlog.html-ib9svlbN.js new file mode 100644 index 00000000..31563176 --- /dev/null +++ b/assets/serverlog.html-ib9svlbN.js @@ -0,0 +1 @@ +const t=JSON.parse('{"key":"v-60eda44c","path":"/java/serverlog.html","title":"被挖矿攻击","lang":"zh-CN","frontmatter":{"description":"被挖矿攻击 服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看: stratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/serverlog.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"被挖矿攻击"}],["meta",{"property":"og:description","content":"被挖矿攻击 服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看: stratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"被挖矿攻击\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.57,"words":172},"filePathRelative":"java/serverlog.md","localizedDate":"2024年1月24日","excerpt":"

被挖矿攻击

\\n

服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看:
\\n\\"\\"
\\nstratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG

","autoDesc":true}');export{t as data}; diff --git a/assets/spark on k8s operator.html-keQuD2fg.js b/assets/spark on k8s operator.html-keQuD2fg.js new file mode 100644 index 00000000..e92e9a10 --- /dev/null +++ b/assets/spark on k8s operator.html-keQuD2fg.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-57ae83ac","path":"/kubernetes/spark%20on%20k8s%20operator.html","title":"spark on k8s operator","lang":"zh-CN","frontmatter":{"description":"spark on k8s operator Spark operator是一个管理Kubernetes上的Apache Spark应用程序生命周期的operator,旨在像在Kubernetes上运行其他工作负载一样简单的指定和运行spark应用程序。 使用Spark Operator管理Spark应用,能更好的利用Kubernetes原生能力控制和管理Spark应用的生命周期,包括应用状态监控、日志获取、应用运行控制等,弥补Spark on Kubernetes方案在集成Kubernetes上与其他类型的负载之间存在的差距。 Spark Operator包括如下几个组件:","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/kubernetes/spark%20on%20k8s%20operator.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"spark on k8s operator"}],["meta",{"property":"og:description","content":"spark on k8s operator Spark operator是一个管理Kubernetes上的Apache Spark应用程序生命周期的operator,旨在像在Kubernetes上运行其他工作负载一样简单的指定和运行spark应用程序。 使用Spark Operator管理Spark应用,能更好的利用Kubernetes原生能力控制和管理Spark应用的生命周期,包括应用状态监控、日志获取、应用运行控制等,弥补Spark on Kubernetes方案在集成Kubernetes上与其他类型的负载之间存在的差距。 Spark Operator包括如下几个组件:"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"spark on k8s operator\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":3.5,"words":1050},"filePathRelative":"kubernetes/spark on k8s operator.md","localizedDate":"2024年1月24日","excerpt":"

spark on k8s operator

\\n

Spark operator是一个管理Kubernetes上的Apache Spark应用程序生命周期的operator,旨在像在Kubernetes上运行其他工作负载一样简单的指定和运行spark应用程序。

\\n

使用Spark Operator管理Spark应用,能更好的利用Kubernetes原生能力控制和管理Spark应用的生命周期,包括应用状态监控、日志获取、应用运行控制等,弥补Spark on Kubernetes方案在集成Kubernetes上与其他类型的负载之间存在的差距。

\\n

Spark Operator包括如下几个组件:

","autoDesc":true}');export{e as data}; diff --git a/assets/spark on k8s operator.html-rCBkXzhV.js b/assets/spark on k8s operator.html-rCBkXzhV.js new file mode 100644 index 00000000..2dd0f98e --- /dev/null +++ b/assets/spark on k8s operator.html-rCBkXzhV.js @@ -0,0 +1,73 @@ +import{_ as p}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as o,o as c,c as l,a as n,d as s,b as t,e}from"./app-hbwtiwmf.js";const i={},u=e(`

spark on k8s operator

Spark operator是一个管理Kubernetes上的Apache Spark应用程序生命周期的operator,旨在像在Kubernetes上运行其他工作负载一样简单的指定和运行spark应用程序。

使用Spark Operator管理Spark应用,能更好的利用Kubernetes原生能力控制和管理Spark应用的生命周期,包括应用状态监控、日志获取、应用运行控制等,弥补Spark on Kubernetes方案在集成Kubernetes上与其他类型的负载之间存在的差距。

Spark Operator包括如下几个组件:

  1. SparkApplication控制器:该控制器用于创建、更新、删除SparkApplication对象,同时控制器还会监控相应的事件,执行相应的动作。
  2. Submission Runner:负责调用spark-submit提交Spark作业,作业提交的流程完全复用Spark on K8s的模式。
  3. Spark Pod Monitor:监控Spark作业相关Pod的状态,并同步到控制器中。
  4. Mutating Admission Webhook:可选模块,基于注解来实现Driver/Executor Pod的一些定制化需求。
  5. SparkCtl:用于和Spark Operator交互的命令行工具。

安装

# 添加源
+helm repo add spark-operator https://googlecloudplatform.github.io/spark-on-k8s-operator
+# 安装
+helm install my-release spark-operator/spark-operator --namespace spark-operator --create-namespace
+

这个时候如果直接执行kubectl apply -f examples/spark-pi.yaml调用样例,会出现以下报错,需要创建对象的serviceaccount。

forbidden: error looking up service account default/spark: serviceaccount \\"spark\\" not found.\\n\\tat io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:568)\\n\\tat io.fabric8.kubernetes.client.dsl.base.OperationSupport
+

同时也要安装rbac

`,10),r={href:"https://github.com/Zephery/spark-java-demo/blob/master/k8s/rbac.yaml",target:"_blank",rel:"noopener noreferrer"},k=e(`

执行脚本,这里用的app.jar是一个读取es数据源,然后计算,为了展示效果,在程序的后面用了TimeUnit.HOURS.sleep(1)方便观察。

代码如下:

 SparkConf sparkConf = new SparkConf().setAppName("Spark WordCount Application (java)");
+        sparkConf.set("es.nodes", "xxx")
+                .set("es.port", "8xx0")
+                .set("es.nodes.wan.only", "true")
+                .set("es.net.http.auth.user", "xxx")
+                .set("es.net.http.auth.pass", "xxx-xxx");
+        try (JavaSparkContext jsc = new JavaSparkContext(sparkConf)) {
+            JavaRDD<Map<String, Object>> esRDD = JavaEsSpark.esRDD(jsc, "kibana_sample_data_ecommerce").values();
+
+            System.out.println(esRDD.partitions().size());
+
+            esRDD.map(x -> x.get("customer_full_name"))
+                    .countByValue()
+                    .forEach((x, y) -> System.out.println(x + ":" + y));
+            TimeUnit.HOURS.sleep(1);
+
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+

打包之后kubectl create -f k8s.yaml即可

apiVersion: "sparkoperator.k8s.io/v1beta2"
+kind: SparkApplication
+metadata:
+  name: spark-demo
+  namespace: default
+spec:
+  type: Scala
+  mode: cluster
+  image: fewfew-docker.pkg.coding.net/spark-java-demo/spark-java-demo-new/spark-java-demo:master-1d8c164bced70a1c66837ea5c0180c61dfb48ac3
+  imagePullPolicy: Always
+  mainClass: com.spark.es.demo.EsReadGroupByName
+  mainApplicationFile: "local:///opt/spark/examples/jars/app.jar"
+  sparkVersion: "3.1.1"
+  restartPolicy:
+    type: Never
+  driver:
+    # 用cores必须要大于等于1,这里用coreRequest
+    coreRequest: "100m"
+    coreLimit: "1200m"
+    memory: "512m"
+    labels:
+      version: 3.1.1
+    serviceAccount: sparkoperator
+  executor:
+    # 用cores必须要大于等于1,这里用coreRequest
+    coreRequest: "100m"
+    instances: 1
+    memory: "512m"
+    labels:
+      version: 3.1.1
+
spark-demo-driver                                          1/1     Running   0          2m30s
+spark-wordcount-application-java-0ac352810a9728e1-exec-1   1/1     Running   0          2m1s
+

同时会自动生成相应的service。

image-20220528203941897
image-20220528203941897
image-20220528203816649

Spark on k8s operator大大减少了spark的部署与运维成本,用容器的调度来替换掉yarn,

源码解析

architecture-diagram

Spark Operator的主要组件如下:

1、SparkApplication Controller : 用于监控并相应SparkApplication的相关对象的创建、更新和删除事件;

2、Submission Runner:用于接收Controller的提交指令,并通过spark-submit 来提交Spark作业到K8S集群并创建Driver Pod,driver正常运行之后将启动Executor Pod;

3、Spark Pod Monitor:实时监控Spark作业相关Pod(Driver、Executor)的运行状态,并将这些状态信息同步到Controller ;

4、Mutating Admission Webhook:可选模块,但是在Spark Operator中基本上所有的有关Spark pod在Kubernetes上的定制化功能都需要使用到该模块,因此建议将enableWebhook这个选项设置为true。

5、sparkctl: 基于Spark Operator的情况下可以不再使用kubectl来管理Spark作业了,而是采用Spark Operator专用的作业管理工具sparkctl,该工具功能较kubectl功能更为强大、方便易用。

image-20220612194403742

apis:用户编写yaml时的解析

Batchscheduler:批处理的调度,提供了支持volcano的接口

Client:

leader的选举

electionCfg := leaderelection.LeaderElectionConfig{
+   Lock:          resourceLock,
+   LeaseDuration: *leaderElectionLeaseDuration,
+   RenewDeadline: *leaderElectionRenewDeadline,
+   RetryPeriod:   *leaderElectionRetryPeriod,
+   Callbacks: leaderelection.LeaderCallbacks{
+      OnStartedLeading: func(c context.Context) {
+         close(startCh)
+      },
+      OnStoppedLeading: func() {
+         close(stopCh)
+      },
+   },
+}
+
+elector, err := leaderelection.NewLeaderElector(electionCfg)
+

参考:

`,25),d={href:"https://blog.csdn.net/chengyinwu/article/details/121049750",target:"_blank",rel:"noopener noreferrer"},m={href:"https://www.cnblogs.com/zhangmingcheng/p/15846133.html",target:"_blank",rel:"noopener noreferrer"};function v(b,g){const a=o("ExternalLinkIcon");return c(),l("div",null,[u,n("p",null,[s("rbac的文件在manifest/spark-operator-install/spark-operator-rbac.yaml,需要把namespace全部改为需要运行的namespace,这里我们任务放在default命名空间下,所以全部改为default,源文件见"),n("a",r,[s("rbac.yaml"),t(a)])]),k,n("p",null,[s("1."),n("a",d,[s("k8s client-go中Leader选举实现"),t(a)])]),n("p",null,[s("2.["),n("a",m,[s("Kubernetes基于leaderelection选举策略实现组件高可用"),t(a)])])])}const f=p(i,[["render",v],["__file","spark on k8s operator.html.vue"]]);export{f as default}; diff --git a/assets/style-PyDCJU7V.css b/assets/style-PyDCJU7V.css new file mode 100644 index 00000000..d4fdf76a --- /dev/null +++ b/assets/style-PyDCJU7V.css @@ -0,0 +1 @@ +html[data-theme=dark]{--text-color: #9e9e9e;--bg-color: #0d1117;--bg-color-secondary: #161b22;--bg-color-tertiary: #21262c;--border-color: #30363d;--box-shadow: #282a32;--card-shadow: rgba(0, 0, 0, .3);--black: #fff;--dark-grey: #999;--light-grey: #666;--white: #000;--grey3: #bbb;--grey12: #333;--grey14: #111;--bg-color-light: #161b22;--bg-color-back: #0d1117;--bg-color-float: #161b22;--bg-color-blur: rgba(13, 17, 23, .9);--bg-color-float-blur: rgba(22, 27, 34, .9);--text-color-light: #a8a8a8;--text-color-lighter: #b1b1b1;--text-color-bright: #c5c5c5;--border-color-light: #2e333a;--border-color-dark: #394048}:root{--theme-color: #2980b9;--text-color: #2c3e50;--bg-color: #fff;--bg-color-secondary: #f8f8f8;--bg-color-tertiary: #efeef4;--border-color: #eaecef;--box-shadow: #f0f1f2;--card-shadow: rgba(0, 0, 0, .15);--black: #000;--dark-grey: #666;--light-grey: #999;--white: #fff;--grey3: #333;--grey12: #bbb;--grey14: #eee;--navbar-height: 3.75rem;--navbar-horizontal-padding: 1.5rem;--navbar-vertical-padding: .7rem;--navbar-mobile-height: 3.25rem;--navbar-mobile-horizontal-padding: 1rem;--navbar-mobile-vertical-padding: .5rem;--sidebar-width: 20rem;--sidebar-mobile-width: 16rem;--content-width: 780px;--home-page-width: 1160px;--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", STHeiti, "Microsoft YaHei", SimSun, sans-serif;--font-family-heading: Georgia Pro, Crimson, Georgia, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", STHeiti, "Microsoft YaHei", SimSun, sans-serif;--font-family-mono: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;--line-numbers-width: 2.5rem;--color-transition: .3s ease;--transform-transition: .3s ease;--vp-bg: var(--bg-color);--vp-bgl: var(--bg-color-light);--vp-bglt: var(--bg-color-tertiary);--vp-c: var(--text-color);--vp-cl: var(--text-color-light);--vp-clt: var(--text-color-lighter);--vp-brc: var(--border-color);--vp-brcd: var(--border-color-dark);--vp-tc: var(--theme-color);--vp-tcl: var(--theme-color-light);--vp-ct: var(--color-transition);--vp-tt: var(--transform-transition);--bg-color-light: #fff;--bg-color-back: #f8f8f8;--bg-color-float: #fff;--bg-color-blur: rgba(255, 255, 255, .9);--bg-color-float-blur: rgba(255, 255, 255, .9);--text-color-light: #3a5169;--text-color-lighter: #476582;--text-color-bright: #6a8bad;--border-color-light: #eceef1;--border-color-dark: #cfd4db;--theme-color-dark: #2573a7;--theme-color-light: #2e90d0;--theme-color-mask: rgba(41, 128, 185, .15)}:root{--badge-tip-color: #42b983;--badge-warning-color: #f4cd00;--badge-danger-color: #f55;--badge-info-color: #0295ff;--badge-note-color: #666}.vp-badge{display:inline-block;vertical-align:center;height:18px;padding:0 6px;border-radius:3px;background:var(--vp-tc);color:var(--white);font-size:14px;line-height:18px;transition:background var(--vp-ct),color var(--vp-ct)}.vp-badge+.vp-badge{margin-inline-start:5px}h1 .vp-badge,h2 .vp-badge,h3 .vp-badge,h4 .vp-badge,h5 .vp-badge,h6 .vp-badge{vertical-align:top}.vp-badge.tip{background:var(--badge-tip-color)}.vp-badge.warning{background:var(--badge-warning-color)}.vp-badge.danger{background:var(--badge-danger-color)}.vp-badge.info{background:var(--badge-info-color)}.vp-badge.note{background:var(--badge-note-color)}.font-icon{display:inline-block}.theme-hope-content .font-icon{vertical-align:middle}:root{--balloon-border-radius: 2px;--balloon-color: rgba(16, 16, 16, .95);--balloon-text-color: #fff;--balloon-font-size: 12px;--balloon-move: 4px}button[aria-label][data-balloon-pos]{overflow:visible}[aria-label][data-balloon-pos]{position:relative;cursor:pointer}[aria-label][data-balloon-pos]:after{opacity:0;pointer-events:none;transition:all .18s ease-out .18s;text-indent:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-weight:400;font-style:normal;text-shadow:none;font-size:var(--balloon-font-size);background:var(--balloon-color);border-radius:2px;color:var(--balloon-text-color);border-radius:var(--balloon-border-radius);content:attr(aria-label);padding:.5em 1em;position:absolute;white-space:nowrap;z-index:10}[aria-label][data-balloon-pos]:before{width:0;height:0;border:5px solid transparent;border-top-color:var(--balloon-color);opacity:0;pointer-events:none;transition:all .18s ease-out .18s;content:"";position:absolute;z-index:10}[aria-label][data-balloon-pos]:hover:before,[aria-label][data-balloon-pos]:hover:after,[aria-label][data-balloon-pos][data-balloon-visible]:before,[aria-label][data-balloon-pos][data-balloon-visible]:after,[aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:before,[aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:after{opacity:1;pointer-events:none}[aria-label][data-balloon-pos].font-awesome:after{font-family:FontAwesome,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}[aria-label][data-balloon-pos][data-balloon-break]:after{white-space:pre}[aria-label][data-balloon-pos][data-balloon-break][data-balloon-length]:after{white-space:pre-line;word-break:break-word}[aria-label][data-balloon-pos][data-balloon-blunt]:before,[aria-label][data-balloon-pos][data-balloon-blunt]:after{transition:none}[aria-label][data-balloon-pos][data-balloon-pos=up]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=up][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=down]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=down][data-balloon-visible]:after{transform:translate(-50%)}[aria-label][data-balloon-pos][data-balloon-pos=up]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=up][data-balloon-visible]:before,[aria-label][data-balloon-pos][data-balloon-pos=down]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=down][data-balloon-visible]:before{transform:translate(-50%)}[aria-label][data-balloon-pos][data-balloon-pos*=-left]:after{left:0}[aria-label][data-balloon-pos][data-balloon-pos*=-left]:before{left:5px}[aria-label][data-balloon-pos][data-balloon-pos*=-right]:after{right:0}[aria-label][data-balloon-pos][data-balloon-pos*=-right]:before{right:5px}[aria-label][data-balloon-pos][data-balloon-po*=-left]:hover:after,[aria-label][data-balloon-pos][data-balloon-po*=-left][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos*=-right]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos*=-right][data-balloon-visible]:after{transform:translate(0)}[aria-label][data-balloon-pos][data-balloon-po*=-left]:hover:before,[aria-label][data-balloon-pos][data-balloon-po*=-left][data-balloon-visible]:before,[aria-label][data-balloon-pos][data-balloon-pos*=-right]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos*=-right][data-balloon-visible]:before{transform:translate(0)}[aria-label][data-balloon-pos][data-balloon-pos^=up]:before,[aria-label][data-balloon-pos][data-balloon-pos^=up]:after{bottom:100%;transform-origin:top;transform:translateY(var(--balloon-move))}[aria-label][data-balloon-pos][data-balloon-pos^=up]:after{margin-bottom:10px}[aria-label][data-balloon-pos][data-balloon-pos=up]:before,[aria-label][data-balloon-pos][data-balloon-pos=up]:after{left:50%;transform:translate(-50%,var(--balloon-move))}[aria-label][data-balloon-pos][data-balloon-pos^=down]:before,[aria-label][data-balloon-pos][data-balloon-pos^=down]:after{top:100%;transform:translateY(calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos^=down]:after{margin-top:10px}[aria-label][data-balloon-pos][data-balloon-pos^=down]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:var(--balloon-color)}[aria-label][data-balloon-pos][data-balloon-pos=down]:after,[aria-label][data-balloon-pos][data-balloon-pos=down]:before{left:50%;transform:translate(-50%,calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos=left]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=left][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=right]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=right][data-balloon-visible]:after{transform:translateY(-50%)}[aria-label][data-balloon-pos][data-balloon-pos=left]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=left][data-balloon-visible]:before,[aria-label][data-balloon-pos][data-balloon-pos=right]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=right][data-balloon-visible]:before{transform:translateY(-50%)}[aria-label][data-balloon-pos][data-balloon-pos=left]:after,[aria-label][data-balloon-pos][data-balloon-pos=left]:before{right:100%;top:50%;transform:translate(var(--balloon-move),-50%)}[aria-label][data-balloon-pos][data-balloon-pos=left]:after{margin-right:10px}[aria-label][data-balloon-pos][data-balloon-pos=left]:before{width:0;height:0;border:5px solid transparent;border-left-color:var(--balloon-color)}[aria-label][data-balloon-pos][data-balloon-pos=right]:after,[aria-label][data-balloon-pos][data-balloon-pos=right]:before{left:100%;top:50%;transform:translate(calc(var(--balloon-move) * -1),-50%)}[aria-label][data-balloon-pos][data-balloon-pos=right]:after{margin-left:10px}[aria-label][data-balloon-pos][data-balloon-pos=right]:before{width:0;height:0;border:5px solid transparent;border-right-color:var(--balloon-color)}[aria-label][data-balloon-pos][data-balloon-length]:after{white-space:normal}[aria-label][data-balloon-pos][data-balloon-length=small]:after{width:80px}[aria-label][data-balloon-pos][data-balloon-length=medium]:after{width:150px}[aria-label][data-balloon-pos][data-balloon-length=large]:after{width:260px}[aria-label][data-balloon-pos][data-balloon-length=xlarge]:after{width:380px}@media screen and (max-width: 768px){[aria-label][data-balloon-pos][data-balloon-length=xlarge]:after{width:90vw}}[aria-label][data-balloon-pos][data-balloon-length=fit]:after{width:100%}.vp-back-to-top-button{border-width:0;background:transparent;cursor:pointer;position:fixed!important;bottom:64px;inset-inline-end:1rem;z-index:100;width:48px;height:48px;padding:8px;border-radius:50%;background:var(--vp-bg);color:var(--vp-tc);box-shadow:2px 2px 10px 4px var(--card-shadow);transition:background var(--vp-ct),color var(--vp-ct),box-shadow var(--vp-ct)}@media (max-width: 719px){.vp-back-to-top-button{width:36px;height:36px}}@media print{.vp-back-to-top-button{display:none}}.vp-back-to-top-button:hover{color:var(--vp-tcl)}.vp-back-to-top-button .back-to-top-icon{overflow:hidden;width:100%;border-radius:50%;fill:currentcolor}.vp-scroll-progress{position:absolute;right:-2px;bottom:-2px;width:52px;height:52px}@media (max-width: 719px){.vp-scroll-progress{width:40px;height:40px}}.vp-scroll-progress svg{width:100%;height:100%}.vp-scroll-progress circle{opacity:.9;fill:none;stroke:var(--vp-tc);transform:rotate(-90deg);transform-origin:50% 50%;r:22;stroke-dasharray:0% 314.1593%;stroke-width:3px}@media (max-width: 719px){.vp-scroll-progress circle{r:18}}.fade-enter-active,.fade-leave-active{transition:opacity var(--vp-ct)}.fade-enter-from,.fade-leave-to{opacity:0}:root{--notice-width: 250px}.notice-fade-enter-active,.notice-fade-leave-active{transition:opacity .5s}.notice-fade-enter,.notice-fade-leave-to{opacity:0}.vp-notice-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1499;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}@media print{.vp-notice-mask{display:none}}.vp-notice-wrapper{position:fixed;top:80px;inset-inline-end:20px;z-index:1500;overflow:hidden;width:var(--notice-width);border-radius:8px;background:var(--vp-bg);box-shadow:0 2px 6px 0 var(--card-shadow)}@media print{.vp-notice-wrapper{display:none}}.vp-notice-wrapper.fullscreen{top:50vh;right:50vw;left:unset;transform:translate(50%,-50%)}.vp-notice-title{position:relative;margin:0;padding:8px 12px;background:var(--vp-tc);color:var(--white);font-weight:500;text-align:start}.vp-notice-title .close-icon{vertical-align:middle;float:right;width:1em;height:1em;margin:auto;padding:4px;border-radius:50%;background-color:#0003;color:var(--white);cursor:pointer}html[dir=rtl] .vp-notice-title .close-icon{float:left}.vp-notice-title .close-icon:hover{background-color:#0000004d}.vp-notice-content{margin:1rem .75rem;font-size:14px;line-height:1.5}.vp-notice-footer{padding-bottom:8px;text-align:center}.vp-notice-footer-action{display:inline-block;margin:4px;padding:8px 12px;border:none;border-radius:8px;background-color:var(--vp-bglt);color:var(--vp-c);cursor:pointer}.vp-notice-footer-action:hover{background-color:var(--vp-bgl)}.vp-notice-footer-action.primary{background-color:var(--vp-tc);color:var(--white)}.vp-notice-footer-action.primary:hover{background-color:var(--vp-tcl)}@media screen{.sr-only{position:absolute;overflow:hidden;clip:rect 0,0,0,0;width:1px;height:1px;margin:-1px;padding:0;border:0}}@media print{.sr-only{display:none}}.vp-catalog-wrapper{margin-top:8px;margin-bottom:8px}.vp-catalog-wrapper.index ol{padding-inline-start:0}.vp-catalog-wrapper.index li{list-style-type:none}.vp-catalog-wrapper.index .vp-catalogs{padding-inline-start:0}.vp-catalog-wrapper.index .vp-catalog{list-style-type:none}.vp-catalog-wrapper.index .vp-catalog-title:before{content:"§" counter(catalog-item,upper-roman) " "}.vp-catalog-wrapper.index .vp-child-catalogs{counter-reset:child-catalog}.vp-catalog-wrapper.index .vp-child-catalog{counter-increment:child-catalog}.vp-catalog-wrapper.index .vp-child-catalog .vp-catalog-title:before{content:counter(catalog-item) "." counter(child-catalog) " "}.vp-catalog-wrapper.index .vp-sub-catalogs{padding-inline-start:.5rem}.vp-catalogs{margin:0;counter-reset:catalog-item}.vp-catalogs.deep{padding-inline-start:0}.vp-catalogs.deep .vp-catalog{list-style-type:none}.vp-catalogs .font-icon{vertical-align:baseline;margin-inline-end:.25rem}.vp-catalog{counter-increment:catalog-item}.vp-catalog-main-title{margin-top:calc(.5rem - var(--navbar-height, 3.6rem));margin-bottom:.5rem;padding-top:var(--navbar-height, 3.6rem);font-weight:500;font-size:1.75rem}.vp-catalog-main-title:first-child{margin-bottom:.5rem!important}.vp-catalog-main-title:only-child{margin-bottom:0!important}.vp-catalog-child-title{margin-bottom:.5rem!important}.vp-catalog-child-title.has-children{margin-top:calc(.5rem - var(--navbar-height, 3.6rem));padding-top:var(--navbar-height, 3.6rem);border-bottom:1px solid var(--vp-brc);font-weight:500;font-size:1.3rem;transition:border-color var(--vp-ct)}.vp-catalog-child-title.has-children:only-child{margin-bottom:0!important}.vp-catalog-sub-title{font-weight:500;font-size:1.1rem}.vp-catalog-sub-title:only-child{margin-bottom:0!important}.vp-catalog-title{color:inherit;text-decoration:none}.vp-catalog-title:hover{color:var(--vp-tc)}.vp-child-catalogs{margin:0}.vp-child-catalog{list-style-type:disc}.vp-sub-catalogs{counter-reset:sub-catalog}.vp-sub-catalog{counter-increment:sub-catalog}.vp-sub-catalog .vp-link:before{content:counter(catalog-item) "." counter(child-catalog) "." counter(sub-catalog) " "}.vp-sub-catalogs-wrapper{display:flex;flex-wrap:wrap}.vp-sub-catalog-link{display:inline-block;margin:4px 8px;padding:4px 8px;border-radius:6px;background-color:var(--vp-bgl);line-height:1.5;overflow-wrap:break-word;transition:background-color var(--vp-ct),color var(--vp-ct)}.vp-sub-catalog-link:hover{background-color:var(--vp-tcl);color:var(--vp-bg);text-decoration:none!important}.vp-empty-catalog{font-size:1.25rem;text-align:center}:root{--external-link-icon-color: #aaa}.external-link-icon{position:relative;display:inline-block;color:var(--external-link-icon-color);vertical-align:middle;top:-1px}@media print{.external-link-icon{display:none}}.external-link-icon-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}:root{--nprogress-color: #29d;--nprogress-z-index: 1031}#nprogress{pointer-events:none}#nprogress .bar{background:var(--nprogress-color);position:fixed;z-index:var(--nprogress-z-index);top:0;left:0;width:100%;height:2px}:root{--copy-icon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2'/%3E%3C/svg%3E");--copied-icon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-6 9 2 2 4-4'/%3E%3C/svg%3E")}div[class*=language-]>button.copy-code-button{border-width:0;background:transparent;position:absolute;outline:none;cursor:pointer}@media print{div[class*=language-]>button.copy-code-button{display:none}}div[class*=language-]>button.copy-code-button .copy-icon{background:currentcolor;-webkit-mask-image:var(--copy-icon);mask-image:var(--copy-icon);-webkit-mask-position:50%;mask-position:50%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:1em;mask-size:1em}div[class*=language-]>button.copy-code-button:not(.fancy){border-width:0;background:transparent;cursor:pointer;position:absolute;top:.5em;right:.5em;z-index:5;width:2.5rem;height:2.5rem;padding:0;border-radius:.5rem;opacity:0;transition:opacity .4s}div[class*=language-]>button.copy-code-button:not(.fancy):hover,div[class*=language-]>button.copy-code-button:not(.fancy).copied{background:var(--code-hl-bg-color, rgba(0, 0, 0, .66))}div[class*=language-]>button.copy-code-button:not(.fancy):focus,div[class*=language-]>button.copy-code-button:not(.fancy).copied{opacity:1}div[class*=language-]>button.copy-code-button:not(.fancy).copied:after{content:attr(data-copied);position:absolute;top:0;right:calc(100% + .25rem);display:block;height:1.25rem;padding:.625rem;border-radius:.5rem;background:var(--code-hl-bg-color, rgba(0, 0, 0, .66));color:var(--code-ln-color, #9e9e9e);font-weight:500;line-height:1.25rem;white-space:nowrap}div[class*=language-]>button.copy-code-button:not(.fancy) .copy-icon{width:1.25rem;height:1.25rem;padding:.625rem;color:var(--code-ln-color, #9e9e9e);font-size:1.25rem}div[class*=language-]>button.copy-code-button.fancy{right:-14px;bottom:-14px;z-index:5;width:2rem;height:2rem;padding:7px 8px;border-radius:50%;background:#339af0;color:#fff}@media (max-width: 419px){div[class*=language-]>button.copy-code-button.fancy{right:0;bottom:0;width:28px;height:28px;border-radius:50% 10% 0}}div[class*=language-]>button.copy-code-button.fancy:hover{background:#228be6}div[class*=language-]>button.copy-code-button.fancy .copy-icon{width:100%;height:100%;color:#fff;font-size:1.25rem}@media (max-width: 419px){div[class*=language-]>button.copy-code-button.fancy .copy-icon{position:relative;top:2px;left:2px}}div[class*=language-]>button.copy-code-button.copied .copy-icon{-webkit-mask-image:var(--copied-icon);mask-image:var(--copied-icon)}div[class*=language-]:hover:before{display:none}div[class*=language-]:hover>button.copy-code-button:not(.fancy){opacity:1}.vp-code-tabs-nav{overflow-x:auto;margin:.85rem 0 -.85rem;padding:0;border-radius:6px 6px 0 0;background:var(--code-tabs-nav-bg-color, #3a404c);list-style:none;white-space:nowrap;transition:background var(--vp-ct)}@media print{.vp-code-tabs-nav{display:none}}@media (max-width: 419px){.vp-code-tabs-nav{margin-inline:-1.5rem;border-radius:0}}.vp-code-tab-nav{border-width:0;position:relative;min-width:3rem;margin:0;padding:6px 12px;border-radius:6px 6px 0 0;background:transparent;color:var(--code-tabs-nav-text-color, #eee);font-weight:600;font-size:.85em;line-height:1.4;cursor:pointer;transition:background var(--vp-ct),color var(--vp-ct)}.vp-code-tab-nav:hover{background:var(--code-tabs-nav-hover-color, #434a57)}.vp-code-tab-nav:before,.vp-code-tab-nav:after{content:" ";position:absolute;bottom:0;z-index:1;width:6px;height:6px}.vp-code-tab-nav:before{right:100%}.vp-code-tab-nav:after{left:100%}.vp-code-tab-nav.active{background:var(--code-bg-color, #282c34)}.vp-code-tab-nav.active:before{background:radial-gradient(12px at left top,transparent 50%,var(--code-bg-color, #282c34) 50%)}.vp-code-tab-nav.active:after{background:radial-gradient(12px at right top,transparent 50%,var(--code-bg-color, #282c34) 50%)}.vp-code-tab-nav:first-child:before{display:none}html[dir=rtl] .vp-code-tab-nav:first-child:before{display:block}html[dir=rtl] .vp-code-tab-nav:first-child:after{display:none}.vp-code-tab{display:none}@media print{.vp-code-tab{display:block}}.vp-code-tab.active{display:block}.vp-code-tab div[class*=language-]{border-top-left-radius:0;border-top-right-radius:0}@media (max-width: 419px){.vp-code-tab div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}@media print{.vp-code-tab div[class*=language-] code{white-space:pre-wrap}}.vp-code-tab-title{display:none;font-weight:500}@media print{.vp-code-tab-title{display:block}}.code-group-nav{display:flex;margin:.85rem 0 -.85rem;padding:0;border-radius:6px 6px 0 0;background:var(--code-tabs-nav-bg-color, #3a404c);list-style:none;transition:background var(--vp-ct)}@media (max-width: 419px){.code-group-nav{margin-inline:-1.5rem;border-radius:0}}.code-group-nav-tab{border-width:0;position:relative;min-width:3rem;margin:0;padding:6px 10px;border-radius:6px 6px 0 0;background:transparent;color:var(--code-tabs-nav-text-color, #eee);font-weight:600;font-size:.85em;line-height:1.4;cursor:pointer;transition:background var(--vp-ct),color var(--vp-ct)}.code-group-nav-tab:hover{background:var(--code-tabs-nav-hover-color, #434a57)}.code-group-nav-tab:before,.code-group-nav-tab:after{content:" ";position:absolute;bottom:0;z-index:1;width:6px;height:6px}.code-group-nav-tab:before{right:100%}.code-group-nav-tab:after{left:100%}.code-group-nav-tab.active{background:var(--code-bg-color, #282c34)}.code-group-nav-tab.active:before{background:radial-gradient(12px at left top,transparent 50%,var(--code-bg-color, #282c34) 50%)}.code-group-nav-tab.active:after{background:radial-gradient(12px at right top,transparent 50%,var(--code-bg-color, #282c34) 50%)}.code-group-nav-tab:first-child:before{display:none}html[dir=rtl] .code-group-nav-tab:first-child:before{display:block}html[dir=rtl] .code-group-nav-tab:first-child:after{display:none}.code-group-item{display:none}.code-group-item.active{display:block}.code-group-item div[class*=language-]{border-top-left-radius:0;border-top-right-radius:0}.vp-card{display:inline-flex;align-items:center;max-width:400px;margin:1rem .5rem;padding:1rem;border-radius:.5rem;background:var(--vp-bg);color:inherit;box-shadow:2px 2px 10px 0 var(--card-shadow);transition:background var(--vp-ct),box-shadow var(--vp-ct)}.vp-card:hover{background:var(--vp-bgl);text-decoration:none!important}.vp-card hr{margin:.25em 0}.vp-card-logo{width:3em;height:3em;margin-inline-end:1em;border-radius:50%}.vp-card-content{flex:1}.vp-card-title{font-weight:500;font-size:1.1em}.vp-card-desc{color:#888;font-size:.9em;line-height:1.5;transition:color var(--vp-ct)}.vp-card-container{display:flex;flex-wrap:wrap;align-items:stretch;place-content:stretch center}.vp-card-container .vp-card{flex-basis:calc(50% - 3rem);max-width:unset;margin:.5rem}@media (max-width: 959px){.vp-card-container .vp-card{flex-basis:100%}}@media (max-width: 719px){.vp-card-container .vp-card{font-size:.95rem}}@media (max-width: 419px){.vp-card-container .vp-card{font-size:.9rem}}.theme-hope-content figure{position:relative;display:flex;flex-direction:column;width:auto;margin:1rem auto;text-align:center;transition:transform var(--vp-tt)}.theme-hope-content figure img{overflow:hidden;margin:0 auto;border-radius:8px}.theme-hope-content figure img[tabindex]:hover,.theme-hope-content figure img[tabindex]:focus{box-shadow:2px 2px 10px 0 var(--card-shadow)}@media print{.theme-hope-content figure>a[href^="http://"]:after,.theme-hope-content figure>a[href^="https://"]:after{content:""}}.theme-hope-content figure>a .external-link-icon{display:none}.theme-hope-content figure figcaption{display:inline-block;margin:6px auto;font-size:.8rem}.footnote-item{margin-top:calc(0rem - var(--navbar-height, 3.6rem));padding-top:calc(var(--navbar-height, 3.6rem) + .5rem)}.footnote-item>p{margin-bottom:0}.footnote-ref{position:relative}.footnote-anchor{position:absolute;top:calc(-.5rem - var(--navbar-height, 3.6rem))}:root{--important-title-color: #230555;--important-bg-color: #f4eefe;--important-border-color: #a371f7;--important-code-bg-color: rgb(163 113 247 / 10%);--info-title-color: #193c47;--info-bg-color: #eef9fd;--info-border-color: #4cb3d4;--info-code-bg-color: rgb(76 179 212 / 10%);--note-title-color: #474748;--note-bg-color: #fdfdfe;--note-border-color: #ccc;--note-code-bg-color: rgb(212 213 216 / 20%);--tip-title-color: #003100;--tip-bg-color: #e6f6e6;--tip-border-color: #009400;--tip-code-bg-color: rgb(0 148 0 / 15%);--warning-title-color: #4d3800;--warning-bg-color: #fff8e6;--warning-border-color: #e6a700;--warning-code-bg-color: rgb(230 167 0 / 15%);--caution-title-color: #4b1113;--caution-bg-color: #ffebec;--caution-border-color: #e13238;--caution-code-bg-color: rgb(225 50 56 / 15%);--detail-bg-color: #eee;--detail-text-color: inherit;--detail-code-bg-color: rgb(127 127 127 / 15%)}html[data-theme=dark]{--important-title-color: #f4eefe;--important-bg-color: #230555;--info-title-color: #eef9fd;--info-bg-color: #193c47;--note-title-color: #fdfdfe;--note-bg-color: #474748;--tip-title-color: #e6f6e6;--tip-bg-color: #003100;--warning-title-color: #fff8e6;--warning-bg-color: #4d3800;--caution-title-color: #ffebec;--caution-bg-color: #4b1113;--detail-bg-color: #333;--detail-text-color: #a8a8a8}.hint-container{position:relative;transition:background var(--vp-ct),border-color var(--vp-ct),color var(--vp-ct)}@media print{.hint-container{page-break-inside:avoid}}.hint-container .hint-container-title{position:relative;font-weight:600;line-height:1.25}.hint-container.important,.hint-container.info,.hint-container.note,.hint-container.tip,.hint-container.warning,.hint-container.caution{margin:1rem 0;padding:.25rem 1rem;border-inline-start-width:.3rem;border-inline-start-style:solid;border-radius:.5rem;color:inherit}@media (max-width: 419px){.hint-container.important,.hint-container.info,.hint-container.note,.hint-container.tip,.hint-container.warning,.hint-container.caution{margin-inline:-.75rem}}.hint-container.important .hint-container-title,.hint-container.info .hint-container-title,.hint-container.note .hint-container-title,.hint-container.tip .hint-container-title,.hint-container.warning .hint-container-title,.hint-container.caution .hint-container-title{padding-inline-start:1.75rem}@media print{.hint-container.important .hint-container-title,.hint-container.info .hint-container-title,.hint-container.note .hint-container-title,.hint-container.tip .hint-container-title,.hint-container.warning .hint-container-title,.hint-container.caution .hint-container-title{padding-inline-start:0}}.hint-container.important .hint-container-title:before,.hint-container.info .hint-container-title:before,.hint-container.note .hint-container-title:before,.hint-container.tip .hint-container-title:before,.hint-container.warning .hint-container-title:before,.hint-container.caution .hint-container-title:before{content:" ";position:absolute;top:calc(50% - .6125em);inset-inline-start:0;width:1.25em;height:1.25em;background-position:left;background-repeat:no-repeat}@media print{.hint-container.important .hint-container-title:before,.hint-container.info .hint-container-title:before,.hint-container.note .hint-container-title:before,.hint-container.tip .hint-container-title:before,.hint-container.warning .hint-container-title:before,.hint-container.caution .hint-container-title:before{display:none}}.hint-container.important p,.hint-container.info p,.hint-container.note p,.hint-container.tip p,.hint-container.warning p,.hint-container.caution p{line-height:1.5}.hint-container.important a,.hint-container.info a,.hint-container.note a,.hint-container.tip a,.hint-container.warning a,.hint-container.caution a{color:var(--vp-tc)}.hint-container.important{border-color:var(--important-border-color);background:var(--important-bg-color)}.hint-container.important>.hint-container-title{color:var(--important-title-color)}.hint-container.important>.hint-container-title:before{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath d='M512 981.333a84.992 84.992 0 0 1-84.907-84.906h169.814A84.992 84.992 0 0 1 512 981.333zm384-128H128v-42.666l85.333-85.334v-256A298.325 298.325 0 0 1 448 177.92V128a64 64 0 0 1 128 0v49.92a298.325 298.325 0 0 1 234.667 291.413v256L896 810.667v42.666zm-426.667-256v85.334h85.334v-85.334h-85.334zm0-256V512h85.334V341.333h-85.334z' fill='%23a371f7'/%3E%3C/svg%3E")}.hint-container.important code{background:var(--important-code-bg-color)}.hint-container.info{border-color:var(--info-border-color);background:var(--info-bg-color)}.hint-container.info>.hint-container-title{color:var(--info-title-color)}.hint-container.info>.hint-container-title:before{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-1-11v6h2v-6h-2zm0-4v2h2V7h-2z' fill='%234cb3d4'/%3E%3C/svg%3E")}.hint-container.info code{background:var(--info-code-bg-color)}.hint-container.note{border-color:var(--note-border-color);background:var(--note-bg-color)}.hint-container.note>.hint-container-title{color:var(--note-title-color)}.hint-container.note>.hint-container-title:before{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-1-11v6h2v-6h-2zm0-4v2h2V7h-2z' fill='%23ccc'/%3E%3C/svg%3E")}.hint-container.note code{background:var(--note-code-bg-color)}.hint-container.tip{border-color:var(--tip-border-color);background:var(--tip-bg-color)}.hint-container.tip>.hint-container-title{color:var(--tip-title-color)}.hint-container.tip>.hint-container-title:before{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23009400' d='M7.941 18c-.297-1.273-1.637-2.314-2.187-3a8 8 0 1 1 12.49.002c-.55.685-1.888 1.726-2.185 2.998H7.94zM16 20v1a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-1h8zm-3-9.995V6l-4.5 6.005H11v4l4.5-6H13z'/%3E%3C/svg%3E")}.hint-container.tip code{background:var(--tip-code-bg-color)}.hint-container.warning{border-color:var(--warning-border-color);background:var(--warning-bg-color)}.hint-container.warning>.hint-container-title{color:var(--warning-title-color)}.hint-container.warning>.hint-container-title:before{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath d='M576.286 752.57v-95.425q0-7.031-4.771-11.802t-11.3-4.772h-96.43q-6.528 0-11.3 4.772t-4.77 11.802v95.424q0 7.031 4.77 11.803t11.3 4.77h96.43q6.528 0 11.3-4.77t4.77-11.803zm-1.005-187.836 9.04-230.524q0-6.027-5.022-9.543-6.529-5.524-12.053-5.524H456.754q-5.524 0-12.053 5.524-5.022 3.516-5.022 10.547l8.538 229.52q0 5.023 5.022 8.287t12.053 3.265h92.913q7.032 0 11.803-3.265t5.273-8.287zM568.25 95.65l385.714 707.142q17.578 31.641-1.004 63.282-8.538 14.564-23.354 23.102t-31.892 8.538H126.286q-17.076 0-31.892-8.538T71.04 866.074q-18.582-31.641-1.004-63.282L455.75 95.65q8.538-15.57 23.605-24.61T512 62t32.645 9.04 23.605 24.61z' fill='%23e6a700'/%3E%3C/svg%3E")}.hint-container.warning code{background:var(--warning-code-bg-color)}.hint-container.caution{border-color:var(--caution-border-color);background:var(--caution-bg-color)}.hint-container.caution>.hint-container-title{color:var(--caution-title-color)}.hint-container.caution>.hint-container-title:before{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c5.523 0 10 4.477 10 10v3.764a2 2 0 0 1-1.106 1.789L18 19v1a3 3 0 0 1-2.824 2.995L14.95 23a2.5 2.5 0 0 0 .044-.33L15 22.5V22a2 2 0 0 0-1.85-1.995L13 20h-2a2 2 0 0 0-1.995 1.85L9 22v.5c0 .171.017.339.05.5H9a3 3 0 0 1-3-3v-1l-2.894-1.447A2 2 0 0 1 2 15.763V12C2 6.477 6.477 2 12 2zm-4 9a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm8 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4z' fill='%23e13238'/%3E%3C/svg%3E")}.hint-container.caution code{background:var(--caution-code-bg-color)}.hint-container.details{position:relative;display:block;margin:1rem 0;padding:1.5rem;border-radius:.5rem;background:var(--detail-bg-color);color:var(--detail-text-color);transition:background var(--vp-tt),color var(--vp-tt)}@media (max-width: 419px){.hint-container.details{margin-inline:-.75rem}}.hint-container.details h4{margin-top:0}.hint-container.details figure:last-child,.hint-container.details p:last-child{margin-bottom:0;padding-bottom:0}.hint-container.details a{color:var(--vp-tc)}.hint-container.details code{background:var(--detail-code-bg-color)}.hint-container.details summary{position:relative;margin:-1.5rem;padding-block:1.5rem;padding-inline:4rem 1.5rem;list-style:none;cursor:pointer}.hint-container.details summary::-webkit-details-marker{display:none}.hint-container.details summary::marker{color:transparent;font-size:0}.hint-container.details summary:before,.hint-container.details summary:after{content:" ";position:absolute;top:calc(50% - .75rem);inset-inline-start:1.5rem;width:1.5rem;height:1.5rem}.hint-container.details summary:before{border-radius:50%;background:#ccc;transition:background var(--vp-ct),transform var(--vp-tt)}html[data-theme=dark] .hint-container.details summary:before{background:#555}.hint-container.details summary:after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");line-height:normal;transition:transform var(--vp-tt);transform:rotate(90deg)}html[data-theme=dark] .hint-container.details summary:after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E")}.hint-container.details[open]>summary{margin-bottom:.5em}.hint-container.details[open]>summary:after{transform:rotate(180deg)}html[data-theme=light] figure:has(img[data-mode=darkmode-only]),html[data-theme=light] img[data-mode=darkmode-only]{display:none!important}html[data-theme=dark] figure:has(img[data-mode=lightmode-only]),html[data-theme=dark] img[data-mode=lightmode-only]{display:none!important}mjx-container[jax=SVG]{direction:ltr}mjx-container[jax=SVG]>svg{overflow:visible;min-height:1px;min-width:1px}mjx-container[jax=SVG]>svg a{fill:#00f;stroke:#00f}mjx-assistive-mml{position:absolute!important;top:0;left:0;clip:rect(1px,1px,1px,1px);padding:1px 0 0!important;border:0px!important;display:block!important;width:auto!important;overflow:hidden!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}mjx-assistive-mml[display=block]{width:100%!important}mjx-container[jax=SVG][display=true]{display:block;text-align:center;margin:1em 0}mjx-container[jax=SVG][display=true][width=full]{display:flex}mjx-container[jax=SVG][justify=left]{text-align:left}mjx-container[jax=SVG][justify=right]{text-align:right}g[data-mml-node=merror]>g{fill:red;stroke:red}g[data-mml-node=merror]>rect[data-background]{fill:#ff0;stroke:none}g[data-mml-node=mtable]>line[data-line],svg[data-table]>g>line[data-line]{stroke-width:70px;fill:none}g[data-mml-node=mtable]>rect[data-frame],svg[data-table]>g>rect[data-frame]{stroke-width:70px;fill:none}g[data-mml-node=mtable]>.mjx-dashed,svg[data-table]>g>.mjx-dashed{stroke-dasharray:140}g[data-mml-node=mtable]>.mjx-dotted,svg[data-table]>g>.mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}g[data-mml-node=mtable]>g>svg{overflow:visible}[jax=SVG] mjx-tool{display:inline-block;position:relative;width:0;height:0}[jax=SVG] mjx-tool>mjx-tip{position:absolute;top:0;left:0}mjx-tool>mjx-tip{display:inline-block;padding:.2em;border:1px solid #888;font-size:70%;background-color:#f8f8f8;color:#000;box-shadow:2px 2px 5px #aaa}g[data-mml-node=maction][data-toggle]{cursor:pointer}mjx-status{display:block;position:fixed;left:1em;bottom:1em;min-width:25%;padding:.2em .4em;border:1px solid #888;font-size:90%;background-color:#f8f8f8;color:#000}foreignObject[data-mjx-xml]{font-family:initial;line-height:normal;overflow:visible}mjx-container[jax=SVG] path[data-c],mjx-container[jax=SVG] use[data-c]{stroke-width:3}mjx-container{overflow-x:auto}.task-list-container{padding-inline-start:0;list-style-position:inside}.task-list-container .task-list-container{padding-inline-start:1.5em}.task-list-item{list-style:none}.task-list-item-checkbox{position:relative;cursor:pointer}.task-list-item-checkbox:after{content:" ";position:absolute;top:0;display:inline-block;box-sizing:border-box;width:1em;height:1em;padding-inline-start:0;border:1px solid #ddd;border-radius:2px;background:#fff;text-align:center;visibility:visible;transition:background var(--vp-ct),border-color var(--vp-ct)}@media print{.task-list-item-checkbox:after{border-color:var(--vp-c)}}html[data-theme=dark] .task-list-item-checkbox:after{border-color:#666;background:#333}.task-list-item-checkbox:checked:after{content:"";border-color:var(--vp-tc);background:var(--vp-tc)}@media print{.task-list-item-checkbox:checked:after{border-color:var(--vp-c);background:transparent}}html[data-theme=dark] .task-list-item-checkbox:checked:after{border-color:var(--vp-tc);background:var(--vp-tc)}.task-list-item-checkbox:checked:before{content:"";position:absolute;top:.1em;inset-inline-start:.4em;z-index:1;width:.2em;height:.5em;border:solid var(--white);border-width:0 .15em .15em 0;transform:rotate(45deg)}@media print{.task-list-item-checkbox:checked:before{border-color:var(--vp-c)}}/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */.pswp{--pswp-bg: #000;--pswp-placeholder-bg: #222;--pswp-root-z-index: 100000;--pswp-preloader-color: rgba(79, 79, 79, .4);--pswp-preloader-color-secondary: rgba(255, 255, 255, .9);--pswp-icon-color: #fff;--pswp-icon-color-secondary: #4f4f4f;--pswp-icon-stroke-color: #4f4f4f;--pswp-icon-stroke-width: 2px;--pswp-error-text-color: var(--pswp-icon-color)}.pswp{position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--pswp-root-z-index);display:none;touch-action:none;outline:0;opacity:.003;contain:layout style size;-webkit-tap-highlight-color:rgba(0,0,0,0)}.pswp:focus{outline:0}.pswp *{box-sizing:border-box}.pswp img{max-width:none}.pswp--open{display:block}.pswp,.pswp__bg{transform:translateZ(0);will-change:opacity}.pswp__bg{opacity:.005;background:var(--pswp-bg)}.pswp,.pswp__scroll-wrap{overflow:hidden}.pswp__scroll-wrap,.pswp__bg,.pswp__container,.pswp__item,.pswp__content,.pswp__img,.pswp__zoom-wrap{position:absolute;top:0;left:0;width:100%;height:100%}.pswp__img,.pswp__zoom-wrap{width:auto;height:auto}.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img{cursor:zoom-in}.pswp--click-to-zoom.pswp--zoomed-in .pswp__img{cursor:move;cursor:grab}.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active{cursor:grabbing}.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img,.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active,.pswp__img{cursor:zoom-out}.pswp__container,.pswp__img,.pswp__button,.pswp__counter{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pswp__item{z-index:1;overflow:hidden}.pswp__hidden{display:none!important}.pswp__content{pointer-events:none}.pswp__content>*{pointer-events:auto}.pswp__error-msg-container{display:grid}.pswp__error-msg{margin:auto;font-size:1em;line-height:1;color:var(--pswp-error-text-color)}.pswp .pswp__hide-on-close{opacity:.005;will-change:opacity;transition:opacity var(--pswp-transition-duration) cubic-bezier(.4,0,.22,1);z-index:10;pointer-events:none}.pswp--ui-visible .pswp__hide-on-close{opacity:1;pointer-events:auto}.pswp__button{position:relative;display:block;width:50px;height:60px;padding:0;margin:0;overflow:hidden;cursor:pointer;background:none;border:0;box-shadow:none;opacity:.85;-webkit-appearance:none;-webkit-touch-callout:none}.pswp__button:hover,.pswp__button:active,.pswp__button:focus{transition:none;padding:0;background:none;border:0;box-shadow:none;opacity:1}.pswp__button:disabled{opacity:.3;cursor:auto}.pswp__icn{fill:var(--pswp-icon-color);color:var(--pswp-icon-color-secondary)}.pswp__icn{position:absolute;top:14px;left:9px;width:32px;height:32px;overflow:hidden;pointer-events:none}.pswp__icn-shadow{stroke:var(--pswp-icon-stroke-color);stroke-width:var(--pswp-icon-stroke-width);fill:none}.pswp__icn:focus{outline:0}div.pswp__img--placeholder,.pswp__img--with-bg{background:var(--pswp-placeholder-bg)}.pswp__top-bar{position:absolute;left:0;top:0;width:100%;height:60px;display:flex;flex-direction:row;justify-content:flex-end;z-index:10;pointer-events:none!important}.pswp__top-bar>*{pointer-events:auto;will-change:opacity}.pswp__button--close{margin-right:6px}.pswp__button--arrow{position:absolute;width:75px;height:100px;top:50%;margin-top:-50px}.pswp__button--arrow:disabled{display:none;cursor:default}.pswp__button--arrow .pswp__icn{top:50%;margin-top:-30px;width:60px;height:60px;background:none;border-radius:0}.pswp--one-slide .pswp__button--arrow{display:none}.pswp--touch .pswp__button--arrow{visibility:hidden}.pswp--has_mouse .pswp__button--arrow{visibility:visible}.pswp__button--arrow--prev{right:auto;left:0}.pswp__button--arrow--next{right:0}.pswp__button--arrow--next .pswp__icn{left:auto;right:14px;transform:scaleX(-1)}.pswp__button--zoom{display:none}.pswp--zoom-allowed .pswp__button--zoom{display:block}.pswp--zoomed-in .pswp__zoom-icn-bar-v{display:none}.pswp__preloader{position:relative;overflow:hidden;width:50px;height:60px;margin-right:auto}.pswp__preloader .pswp__icn{opacity:0;transition:opacity .2s linear;animation:pswp-clockwise .6s linear infinite}.pswp__preloader--active .pswp__icn{opacity:.85}@keyframes pswp-clockwise{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.pswp__counter{height:30px;margin-top:15px;margin-inline-start:20px;font-size:14px;line-height:30px;color:var(--pswp-icon-color);text-shadow:1px 1px 3px var(--pswp-icon-color-secondary);opacity:.85}.pswp--one-slide .pswp__counter{display:none}.photo-swipe-loading{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center}.photo-swipe-bullets-indicator{position:absolute;bottom:30px;left:50%;display:flex;flex-direction:row;align-items:center;transform:translate(-50%)}.photo-swipe-bullet{width:12px;height:6px;margin:0 5px;border-radius:3px;background:#fff;transition:width var(--vp-tt),color var(--vp-ct)}.photo-swipe-bullet.active{width:30px;background:var(--vp-tc)}:root{--search-bg-color: #ffffff;--search-accent-color: #3eaf7c;--search-text-color: #2c3e50;--search-border-color: #eaecef;--search-item-text-color: #5d81a5;--search-item-focus-bg-color: #f3f4f5;--search-input-width: 8rem;--search-result-width: 20rem}.search-box{display:inline-block;position:relative;margin-left:1rem}@media print{.search-box{display:none}}.search-box input{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:text;width:var(--search-input-width);height:2rem;color:var(--search-text-color);display:inline-block;border:1px solid var(--search-border-color);border-radius:2rem;font-size:.9rem;line-height:2rem;padding:0 .5rem 0 2rem;outline:none;transition:all ease .3s;background:var(--search-bg-color) url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='13'%3e%3cg%20stroke-width='2'%20stroke='%23aaa'%20fill='none'%3e%3cpath%20d='M11.29%2011.71l-4-4'/%3e%3ccircle%20cx='5'%20cy='5'%20r='4'/%3e%3c/g%3e%3c/svg%3e") .6rem .5rem no-repeat;background-size:1rem}.search-box input:focus{cursor:auto;border-color:var(--search-accent-color)}.search-box .suggestions{background:var(--search-bg-color);width:var(--search-result-width);position:absolute;top:2rem;right:0;border:1px solid var(--search-border-color);border-radius:6px;padding:.4rem;list-style-type:none}.search-box .suggestion{line-height:1.4;padding:.4rem .6rem;border-radius:4px;cursor:pointer}.search-box .suggestion.focus{background-color:var(--search-item-focus-bg-color)}.search-box .suggestion.focus a{color:var(--search-accent-color)}.search-box .suggestion a{white-space:normal;color:var(--search-item-text-color)}.search-box .suggestion .page-title{font-weight:600}.search-box .suggestion .page-header{font-size:.9em;margin-left:.25em}@media (max-width: 719px){.search-box input{cursor:pointer;width:0;border-color:transparent;position:relative}.search-box input:focus{cursor:text;left:0;width:10rem}}@media (max-width: 419px){.search-box input:focus{width:8rem}.search-box .suggestions{width:calc(100vw - 4rem);right:-.5rem}}@keyframes message-move-in{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}@keyframes message-move-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-100%)}}#message-container{position:fixed;inset:calc(var(--navbar-height, 3.6rem) + 1rem) 0 auto;z-index:75;text-align:center}#message-container .message{display:inline-block;padding:8px 10px;border-radius:3px;background:var(--vp-bg);color:var(--vp-c);box-shadow:0 0 10px 0 var(--box-shadow, #f0f1f2);font-size:14px}#message-container .message.move-in{animation:message-move-in .3s ease-in-out}#message-container .message.move-out{animation:message-move-out .3s ease-in-out;animation-fill-mode:forwards}#message-container .message svg{position:relative;bottom:-.125em;margin-inline-end:5px}.vp-article-wrapper{position:relative;box-sizing:border-box;width:100%;margin:0 auto 1.25rem;text-align:start;overflow-wrap:break-word}@media (max-width: 959px){.vp-article-wrapper{margin:0 auto 1rem}}.vp-article-wrapper:last-child{margin-bottom:0}.vp-article-item{display:block;padding:.75rem 1.25rem;border-radius:.4rem;background:var(--bg-color-float);color:inherit;box-shadow:0 1px 3px 1px var(--card-shadow);transition:background var(--color-transition),box-shadow var(--color-transition)}@media (max-width: 959px){.vp-article-item{padding:.75rem 1rem}}@media (max-width: 419px){.vp-article-item{border-radius:0}}.vp-article-item:hover{box-shadow:0 2px 6px 2px var(--card-shadow)}.vp-article-item .sticky-icon{position:absolute;top:0;inset-inline-end:0;width:1.5rem;height:1.5rem;color:var(--theme-color)}.vp-article-item .page-info>span{display:flex;flex-shrink:0;align-items:center;margin-inline-end:.5em;line-height:1.8}.vp-article-item .page-info>span:after{--balloon-font-size: 8px;padding:.3em .6em!important}.vp-article-hr{margin-block:.375em .375em}.vp-article-title{position:relative;display:inline-block;color:var(--text-color);font-size:1.25rem;font-family:var(--font-family-heading);line-height:1.6;cursor:pointer}.vp-article-title:after{content:"";position:absolute;inset:auto 0 0;height:2px;background:var(--theme-color);visibility:hidden;transition:transform .3s ease-in-out;transform:scaleX(0)}.vp-article-title:hover{cursor:pointer}.vp-article-title:hover:after{visibility:visible;transform:scaleX(1)}.vp-article-title a{color:inherit;font-weight:600}.vp-article-title .lock-icon,.vp-article-title .slides-icon{position:relative;bottom:-.125em;display:inline-block;vertical-align:baseline;width:1em;height:1em;margin-inline-end:.25em;color:var(--theme-color)}.vp-article-title>span{word-break:break-word}.vp-article-cover{width:calc(100% + 2.5rem);margin:-.75rem -1.25rem .75rem;border-top-left-radius:.4rem;border-top-right-radius:.4rem}@media (max-width: 959px){.vp-article-cover{width:calc(100% + 2rem);margin:-.75rem -1rem .75rem}}@media (max-width: 419px){.vp-article-cover{border-radius:0}}.vp-article-excerpt{overflow:hidden;line-height:1.6;cursor:default}@media (max-width: 959px){.vp-article-excerpt{font-size:15px}}@media (max-width: 419px){.vp-article-excerpt{font-size:14px}}.vp-article-excerpt h1{display:none}.vp-article-excerpt h2{font-size:1.4em}.vp-article-excerpt h3{font-size:1.2em}.vp-article-excerpt h1,.vp-article-excerpt h2,.vp-article-excerpt h3,.vp-article-excerpt h4,.vp-article-excerpt h5,.vp-article-excerpt h6{margin-top:.5em;margin-bottom:.5em}.vp-article-excerpt h1+p{margin-top:.5em}.vp-article-excerpt p:first-child{margin-top:.5em}.vp-article-excerpt p:last-child{margin-bottom:.5em}.vp-article-excerpt div[class*=language-]{overflow:auto hidden}.vp-article-excerpt div[class*=language-] pre{margin:.85rem 0;line-height:1.375}.vp-article-excerpt div[class*=language-] pre code{padding:0;background:transparent}.vp-article-excerpt div[class*=language-].line-numbers-mode .line-numbers{padding:.85rem 0}.vp-article-excerpt .code-demo-wrapper,.vp-article-excerpt .external-link-icon,.vp-article-excerpt .footnote-anchor{display:none}.vp-article-excerpt section.footnotes{display:none}.vp-article-excerpt img{max-width:100%}.vp-article-excerpt figure{display:flex;flex-direction:column;width:auto;margin:1rem auto;text-align:center;transition:transform var(--transform-transition)}.vp-article-excerpt figure img{overflow:hidden;margin:0 auto;border-radius:8px}.vp-article-excerpt figure figcaption{display:inline-block;margin:6px auto;font-size:.8rem}.vp-article-excerpt figure figcaption:only-child{display:none}.vp-article-list{margin-top:calc(-.5rem - var(--navbar-height));padding-top:calc(var(--navbar-height) + .5rem);text-align:center}.vp-article-list:first-child{margin-top:calc(0rem - var(--navbar-height))}.vp-article-list .empty{max-width:560px;margin:0 auto;text-align:center}.vp-article-type-wrapper{position:relative;z-index:2;display:flex;align-items:center;justify-content:center;padding-inline-start:0;list-style:none;font-weight:600;font-size:18px}@media (max-width: 419px){.vp-article-type-wrapper{font-size:16px}}.vp-article-type{position:relative;vertical-align:middle;margin:.3em .8em;line-height:1.2;cursor:pointer}.vp-article-type:after{content:" ";position:absolute;inset:auto 50% -6px;height:2px;border-radius:1px;background:var(--theme-color);visibility:hidden;transition:inset .2s ease-in-out}.vp-article-type a{display:inline-block;color:inherit;transition:all .3s ease-in-out}.vp-article-type.active{position:relative}.vp-article-type.active a{color:var(--theme-color);transform:scale(1.1)}.vp-article-type:hover:after,.vp-article-type.active:after{inset:auto calc(50% - 8px) -6px;visibility:visible}.vp-blog-hero{position:relative;display:flex;flex-direction:column;justify-content:center;height:450px;margin-bottom:1rem;color:#eee;font-family:var(--font-family-heading)}@media (max-width: 719px){.vp-blog-hero{height:350px}}@media (max-width: 419px){.vp-blog-hero{margin:0 0 1rem}}.vp-blog-hero.no-bg{color:var(--text-color)}.vp-blog-hero>:not(.vp-blog-mask){position:relative;z-index:2}.vp-blog-hero .slide-down-button{border-width:0;background:transparent;cursor:pointer;position:absolute;bottom:0;left:calc(50vw - 30px);display:none;width:60px;height:60px;padding:10px}.vp-blog-hero .slide-down-button .icon{width:30px;margin:-15px 0;animation-name:bounce-down;animation-duration:1.5s;animation-timing-function:linear;animation-iteration-count:infinite;animation-direction:alternate}.vp-blog-hero .slide-down-button .icon:first-child{color:#ffffff26}.vp-blog-hero .slide-down-button .icon:nth-child(2){color:#ffffff80}.vp-blog-hero.fullscreen{height:calc(100vh - var(--navbar-height))!important}.vp-blog-hero.fullscreen .vp-blog-mask{background-position-y:top!important}.vp-blog-hero.fullscreen .slide-down-button{display:block}.vp-blog-mask{position:absolute;top:0;right:0;bottom:0;left:0}.vp-blog-mask:after{content:" ";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;display:block;background:var(--light-grey);opacity:.2}.vp-blog-mask.light{display:block}html[data-theme=dark] .vp-blog-mask.light,.vp-blog-mask.dark{display:none}html[data-theme=dark] .vp-blog-mask.dark{display:block}.vp-blog-hero-title{margin:.5rem auto;font-weight:700;font-size:2rem}@media (min-width: 1440px){.vp-blog-hero-title{font-size:2.25rem}}@media (max-width: 719px){.vp-blog-hero-title{font-size:1.75rem}}.vp-blog-hero-image{display:block;max-width:100%;max-height:15rem;margin:1.5rem auto}@media (max-width: 719px){.vp-blog-hero-image{max-height:12rem}}.vp-blog-hero-image.light{display:block}html[data-theme=dark] .vp-blog-hero-image.light,.vp-blog-hero-image.dark{display:none}html[data-theme=dark] .vp-blog-hero-image.dark{display:block}.vp-blog-hero-image+.vp-blog-hero-title{margin:0 auto}.vp-blog-hero-description{margin:1.2rem auto 0;font-size:1.5rem}@media (max-width: 719px){.vp-blog-hero-description{font-size:1.25rem}}@keyframes bounce-down{0%{transform:translateY(-5px)}to{transform:translateY(5px)}}.vp-blogger-info{padding:.5rem;font-family:var(--font-family-heading);overflow-wrap:break-word}.vp-page .vp-blogger-info{background:var(--bg-color-float);transition:background var(--color-transition)}.vp-sidebar .vp-blogger-info.mobile{display:none}@media (max-width: 719px){.vp-sidebar .vp-blogger-info.mobile{display:block}}.vp-sidebar .vp-blogger-info.mobile+hr{display:none}@media (max-width: 719px){.vp-sidebar .vp-blogger-info.mobile+hr{display:block;margin-top:1rem}}.vp-blogger{padding:.5rem;text-align:center}.vp-blogger-avatar{width:8rem;height:8rem;margin:0 auto}.vp-blogger-avatar.round{border-radius:50%}.vp-blogger-name{margin:1rem auto;font-size:22px}.vp-blogger-description{margin:1rem auto;font-size:14px}.vp-blog-counts{display:flex;width:80%;margin:0 auto 1rem}.vp-blog-count{display:block;width:25%;color:inherit;font-size:13px;text-align:center;cursor:pointer;transition:color var(--color-transition)}.vp-blog-count:hover{color:var(--theme-color)}.vp-blog-count .count{position:relative;margin-bottom:.5rem;font-weight:600;font-size:20px}.vp-category-list{position:relative;z-index:2;padding-inline-start:0;list-style:none;font-size:14px}.vp-category{display:inline-block;vertical-align:middle;overflow:hidden;margin:.3rem .6rem .8rem;padding:.4rem .8rem;border-radius:.25rem;color:var(--dark-grey);box-shadow:0 1px 4px 0 var(--card-shadow);word-break:break-word;cursor:pointer;transition:background var(--color-transition),color var(--color-transition)}@media (max-width: 419px){.vp-category{font-size:.9rem}}.vp-category a{color:inherit}.vp-category .count{display:inline-block;min-width:1rem;height:1.2rem;margin-inline-start:.2em;padding:0 .1rem;border-radius:.6rem;color:var(--white);font-size:.7rem;line-height:1.2rem;text-align:center}.vp-category0{background:#fde5e7;color:#ba111f}html[data-theme=dark] .vp-category0{background:#340509;color:#ec2f3e}.vp-category0:hover{background:#f9bec3}html[data-theme=dark] .vp-category0:hover{background:#53080e}.vp-category0.active{background:#cf1322;color:#fff}html[data-theme=dark] .vp-category0.active{background:#a60f1b;color:var(--bg-color)}.vp-category0.active .count{background:var(--bg-color);color:#cf1322}.vp-category0 .count{background:#cf1322}.vp-category1{background:#ffeee8;color:#f54205}html[data-theme=dark] .vp-category1{background:#441201;color:#fb7649}.vp-category1:hover{background:#fed4c6}html[data-theme=dark] .vp-category1:hover{background:#6d1d02}.vp-category1.active{background:#fa541c;color:#fff}html[data-theme=dark] .vp-category1.active{background:#da3a05;color:var(--bg-color)}.vp-category1.active .count{background:var(--bg-color);color:#fa541c}.vp-category1 .count{background:#fa541c}.vp-category2{background:#fef5e7;color:#e08e0b}html[data-theme=dark] .vp-category2{background:#3e2703;color:#f5b041}.vp-category2:hover{background:#fce6c4}html[data-theme=dark] .vp-category2:hover{background:#633f05}.vp-category2.active{background:#f39c12;color:#fff}html[data-theme=dark] .vp-category2.active{background:#c77e0a;color:var(--bg-color)}.vp-category2.active .count{background:var(--bg-color);color:#f39c12}.vp-category2 .count{background:#f39c12}.vp-category3{background:#eafaf1;color:#29b866}html[data-theme=dark] .vp-category3{background:#0c331c;color:#55d98d}.vp-category3:hover{background:#caf3db}html[data-theme=dark] .vp-category3:hover{background:#12522d}.vp-category3.active{background:#2ecc71;color:#fff}html[data-theme=dark] .vp-category3.active{background:#25a35a;color:var(--bg-color)}.vp-category3.active .count{background:var(--bg-color);color:#2ecc71}.vp-category3 .count{background:#2ecc71}.vp-category4{background:#e6f9ee;color:#219552}html[data-theme=dark] .vp-category4{background:#092917;color:#36d278}.vp-category4:hover{background:#c0f1d5}html[data-theme=dark] .vp-category4:hover{background:#0f4224}.vp-category4.active{background:#25a55b;color:#fff}html[data-theme=dark] .vp-category4.active{background:#1e8449;color:var(--bg-color)}.vp-category4.active .count{background:var(--bg-color);color:#25a55b}.vp-category4 .count{background:#25a55b}.vp-category5{background:#e1fcfc;color:#0e9595}html[data-theme=dark] .vp-category5{background:#042929;color:#16e1e1}.vp-category5:hover{background:#b4f8f8}html[data-theme=dark] .vp-category5:hover{background:#064242}.vp-category5.active{background:#10a5a5;color:#fff}html[data-theme=dark] .vp-category5.active{background:#0d8484;color:var(--bg-color)}.vp-category5.active .count{background:var(--bg-color);color:#10a5a5}.vp-category5 .count{background:#10a5a5}.vp-category6{background:#e4f0fe;color:#0862c3}html[data-theme=dark] .vp-category6{background:#021b36;color:#2589f6}.vp-category6:hover{background:#bbdafc}html[data-theme=dark] .vp-category6:hover{background:#042c57}.vp-category6.active{background:#096dd9;color:#fff}html[data-theme=dark] .vp-category6.active{background:#0757ae;color:var(--bg-color)}.vp-category6.active .count{background:var(--bg-color);color:#096dd9}.vp-category6 .count{background:#096dd9}.vp-category7{background:#f7f1fd;color:#9851e4}html[data-theme=dark] .vp-category7{background:#2a0b4b;color:#bb8ced}.vp-category7:hover{background:#eadbfa}html[data-theme=dark] .vp-category7:hover{background:#431277}.vp-category7.active{background:#aa6fe9;color:#fff}html[data-theme=dark] .vp-category7.active{background:#8733e0;color:var(--bg-color)}.vp-category7.active .count{background:var(--bg-color);color:#aa6fe9}.vp-category7 .count{background:#aa6fe9}.vp-category8{background:#fdeaf5;color:#e81689}html[data-theme=dark] .vp-category8{background:#400626;color:#ef59ab}.vp-category8:hover{background:#facbe5}html[data-theme=dark] .vp-category8:hover{background:#670a3d}.vp-category8.active{background:#eb2f96;color:#fff}html[data-theme=dark] .vp-category8.active{background:#ce147a;color:var(--bg-color)}.vp-category8.active .count{background:var(--bg-color);color:#eb2f96}.vp-category8 .count{background:#eb2f96}html[data-theme=dark] .empty-icon g.people{opacity:.8}html[data-theme=dark] .empty-icon g:not(.people){filter:invert(80%)}.vp-page.vp-blog .vp-blog-home{flex:1;width:0;max-width:780px}.vp-page.vp-blog .theme-hope-content:empty{padding:0}.vp-blog-infos{margin:8px auto;padding:8px 16px}.vp-page .vp-blog-infos{border-radius:6px;background:var(--bg-color-float);box-shadow:0 1px 3px 1px var(--card-shadow);transition:background var(--color-transition),box-shadow var(--color-transition)}.vp-page .vp-blog-infos:hover{box-shadow:0 2px 6px 2px var(--card-shadow)}.vp-blog-infos .timeline-list-wrapper .content{max-height:60vh}.vp-blog-type-switcher{display:flex;justify-content:center;margin-bottom:8px}.vp-blog-type-button{border-width:0;background:transparent;cursor:pointer;width:44px;height:44px;margin:0 8px;padding:4px;color:var(--grey3);transition:color var(--color-transition)}.vp-blog-type-button:focus{outline:none}.vp-blog-type-button .icon-wrapper{width:20px;height:20px;padding:8px;border-radius:50%;background:#7f7f7f26;transition:background var(--color-transition)}html[data-theme=dark] .vp-blog-type-button .icon-wrapper{background:#ffffff26}.vp-blog-type-button .icon-wrapper:hover{cursor:pointer}.vp-blog-type-button .icon-wrapper.active{background:var(--theme-color-light)}html[data-theme=dark] .vp-blog-type-button .icon-wrapper.active{background:var(--theme-color-dark)}.vp-blog-type-button .icon{width:100%;height:100%}.vp-sidebar.hide-icon .vp-blog-type-button .icon{display:block!important}.vp-star-article-wrapper,.vp-category-wrapper,.vp-tag-wrapper{padding:8px 0}.vp-star-article-wrapper .title,.vp-category-wrapper .title,.vp-tag-wrapper .title{cursor:pointer}.vp-star-article-wrapper .title .icon,.vp-category-wrapper .title .icon,.vp-tag-wrapper .title .icon{position:relative;bottom:-.125rem;width:16px;height:16px;margin:0 6px}.vp-star-article-wrapper .title .num,.vp-category-wrapper .title .num,.vp-tag-wrapper .title .num{position:relative;margin:0 2px;font-size:22px;font-family:var(--font-family-heading)}.vp-star-articles{overflow-y:auto;max-height:80vh;margin:8px auto;line-height:1.5}.vp-star-article{padding:12px 8px 4px;border-bottom:1px dashed var(--grey);transition:border-color var(--color-transition),color var(--color-transition)}.vp-star-article a{color:inherit}.vp-star-article:hover{cursor:pointer}.vp-star-article:hover a{color:var(--theme-color)}.vp-category-wrapper .category-list-wrapper,.vp-tag-wrapper .tag-list-wrapper{overflow-y:auto;max-height:80vh;margin:8px auto}.vp-sidebar .vp-blog-info-wrapper .vp-blogger-info{display:none}.vp-page .vp-blog-info-wrapper{position:sticky;top:calc(var(--navbar-height) + .75rem);flex:0 0 300px;box-sizing:border-box;width:300px;height:auto;margin-top:.75rem;margin-bottom:.75rem;margin-inline-start:1rem;transition:all .3s}@media (max-width: 719px){.vp-page .vp-blog-info-wrapper{display:none}}.vp-page .vp-blog-info-wrapper .vp-blogger-info{margin-bottom:16px;padding:8px 0;border-radius:8px;box-shadow:0 1px 3px 1px var(--card-shadow)}.vp-page .vp-blog-info-wrapper .vp-blogger-info:hover{box-shadow:0 2px 6px 2px var(--card-shadow)}.theme-container .vp-page.vp-blog{display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;padding-top:var(--navbar-height);padding-bottom:2rem;background:var(--bg-color-back);transition:background var(--color-transition)}@media (min-width: 1440px){.theme-container.has-toc .vp-page.vp-blog{padding-inline-end:0}}.blog-page-wrapper{display:flex;align-items:flex-start;justify-content:center;box-sizing:border-box;width:100%;margin:0 auto;padding:0 2rem}@media (max-width: 959px){.blog-page-wrapper{padding:0 1rem}}@media (max-width: 419px){.blog-page-wrapper{padding:0}}.vp-blog-main{flex:1;width:0;max-width:780px}.vp-pagination{margin:1.25rem 0 .75rem;font-weight:600;font-size:15px;line-height:2}.vp-pagination-list{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vp-pagination-number{display:flex;align-items:stretch;overflow:hidden;height:30px;margin:0 .5rem;border:1px solid var(--border-color);border-radius:.25rem}.vp-pagination-number div{position:relative;padding:0 .5rem;background:var(--bg-color);color:var(--theme-color);cursor:pointer}.vp-pagination-number div:before{content:" ";position:absolute;top:0;bottom:0;inset-inline-start:0;width:1px;background:var(--border-color)}.vp-pagination-number div:first-child:before{background:transparent}.vp-pagination-number div:hover{color:var(--theme-color-light)}.vp-pagination-number div.active{background:var(--theme-color);color:var(--white)}.vp-pagination-number div.active:before{background:var(--theme-color)}.vp-pagination-number div.active+div:before{background:var(--theme-color)}.vp-pagination-number div.prev,.vp-pagination-number div.next{font-size:13px;line-height:30px}.vp-pagination-number div.active,.vp-pagination-number div.ellipsis{cursor:default}.vp-pagination-nav{display:flex;align-items:center;justify-content:center;margin:.5rem}.vp-pagination-nav input{width:3.5rem;margin:6px 5px;border:1px solid var(--border-color);border-radius:.25em;background:var(--bg-color);color:var(--text-color);outline:none;line-height:2;text-align:center}.vp-pagination-button{overflow:hidden;padding:0 .75em;border:1px solid var(--border-color);border-radius:.25em;background:var(--bg-color);color:var(--theme-color);outline:none;font-weight:600;font-size:15px;line-height:2;cursor:pointer}.vp-pagination-button:hover{color:var(--theme-color-light)}.vp-project-panel{position:relative;z-index:2;display:flex;flex-wrap:wrap;align-items:stretch;place-content:stretch flex-start;margin-bottom:12px}.vp-project-panel:empty{margin-bottom:0}.vp-project-card{position:relative;width:calc(33% - 40px);margin:6px 8px;padding:12px;border-radius:8px;background:var(--bg-color-float);transition:background var(--color-transition),transform var(--transform-transition)}@media (max-width: 959px){.vp-project-card{width:calc(50% - 40px)}}@media (min-width: 1440px){.vp-project-card{width:calc(25% - 40px)}}.vp-project-card:hover{cursor:pointer;transform:scale(.98)}.vp-project-card .icon{position:relative;z-index:2;float:right;width:20px;height:20px}html[dir=rtl] .vp-project-card .icon{float:left}.vp-project-card.project0{background:#fde5e7}.vp-project-card.project0:hover{background:#f9bec3}html[data-theme=dark] .vp-project-card.project0{background:#340509}html[data-theme=dark] .vp-project-card.project0:hover{background:#53080e}.vp-project-card.project1{background:#ffeee8}.vp-project-card.project1:hover{background:#fed4c6}html[data-theme=dark] .vp-project-card.project1{background:#441201}html[data-theme=dark] .vp-project-card.project1:hover{background:#6d1d02}.vp-project-card.project2{background:#fef5e7}.vp-project-card.project2:hover{background:#fce6c4}html[data-theme=dark] .vp-project-card.project2{background:#3e2703}html[data-theme=dark] .vp-project-card.project2:hover{background:#633f05}.vp-project-card.project3{background:#eafaf1}.vp-project-card.project3:hover{background:#caf3db}html[data-theme=dark] .vp-project-card.project3{background:#0c331c}html[data-theme=dark] .vp-project-card.project3:hover{background:#12522d}.vp-project-card.project4{background:#e6f9ee}.vp-project-card.project4:hover{background:#c0f1d5}html[data-theme=dark] .vp-project-card.project4{background:#092917}html[data-theme=dark] .vp-project-card.project4:hover{background:#0f4224}.vp-project-card.project5{background:#e1fcfc}.vp-project-card.project5:hover{background:#b4f8f8}html[data-theme=dark] .vp-project-card.project5{background:#042929}html[data-theme=dark] .vp-project-card.project5:hover{background:#064242}.vp-project-card.project6{background:#e4f0fe}.vp-project-card.project6:hover{background:#bbdafc}html[data-theme=dark] .vp-project-card.project6{background:#021b36}html[data-theme=dark] .vp-project-card.project6:hover{background:#042c57}.vp-project-card.project7{background:#f7f1fd}.vp-project-card.project7:hover{background:#eadbfa}html[data-theme=dark] .vp-project-card.project7{background:#2a0b4b}html[data-theme=dark] .vp-project-card.project7:hover{background:#431277}.vp-project-card.project8{background:#fdeaf5}.vp-project-card.project8:hover{background:#facbe5}html[data-theme=dark] .vp-project-card.project8{background:#400626}html[data-theme=dark] .vp-project-card.project8:hover{background:#670a3d}.vp-project-name{position:relative;z-index:2;color:var(--grey3);font-weight:500;font-size:16px;transition:color var(--color-transition)}.vp-project-desc{position:relative;z-index:2;margin:6px 0;color:var(--dark-grey);font-size:13px}.vp-project-image{position:relative;z-index:2;float:right;width:40px;height:40px}html[dir=rtl] .vp-project-image{float:left}.vp-social-medias{display:flex;flex-wrap:wrap;justify-content:center;margin:8px auto}.vp-social-media{width:26px;height:26px;margin:4px;transition:transform .18s ease-out .18s;transform:scale(1)}.vp-social-media:hover{cursor:pointer;transform:scale(1.2)}.vp-social-media:after{--balloon-font-size: 8px;padding:.3em .6em}.vp-social-media .icon{width:100%;height:100%}.tag-list-wrapper{position:relative;z-index:2;display:flex;flex-wrap:wrap;justify-content:flex-start;padding-inline-start:0;list-style:none}.tag-list-wrapper a{color:inherit}.tag-list-wrapper .tag{position:relative;display:inline-block;vertical-align:middle;overflow:hidden;min-width:24px;margin:4px 6px;padding:3px 8px;border-radius:8px;color:var(--white);box-shadow:0 1px 6px 0 var(--box-shadow);font-size:12px;text-align:center;word-break:break-word;cursor:pointer;transition:background var(--color-transition),box-shadow var(--color-transition),transform var(--color-transition)}.tag-list-wrapper .tag:hover{cursor:pointer}.tag-list-wrapper .tag.active{transform:scale(1.1)}.tag-list-wrapper .tag-num{margin-inline-start:.5em}.tag-list-wrapper .tag0{background:#e91526}.tag-list-wrapper .tag0:hover,.tag-list-wrapper .tag0.active,html[data-theme=dark] .tag-list-wrapper .tag0{background:#c51220}html[data-theme=dark] .tag-list-wrapper .tag0:hover,html[data-theme=dark] .tag-list-wrapper .tag0.active{background:#e91526}.tag-list-wrapper .tag1{background:#fb6533}.tag-list-wrapper .tag1:hover,.tag-list-wrapper .tag1.active,html[data-theme=dark] .tag-list-wrapper .tag1{background:#fa4a0e}html[data-theme=dark] .tag-list-wrapper .tag1:hover,html[data-theme=dark] .tag-list-wrapper .tag1.active{background:#fb6533}.tag-list-wrapper .tag2{background:#f4a62a}.tag-list-wrapper .tag2:hover,.tag-list-wrapper .tag2.active,html[data-theme=dark] .tag-list-wrapper .tag2{background:#ec950c}html[data-theme=dark] .tag-list-wrapper .tag2:hover,html[data-theme=dark] .tag-list-wrapper .tag2.active{background:#f4a62a}.tag-list-wrapper .tag3{background:#40d47f}.tag-list-wrapper .tag3:hover,.tag-list-wrapper .tag3.active,html[data-theme=dark] .tag-list-wrapper .tag3{background:#2cc26b}html[data-theme=dark] .tag-list-wrapper .tag3:hover,html[data-theme=dark] .tag-list-wrapper .tag3.active{background:#40d47f}.tag-list-wrapper .tag4{background:#2bbe69}.tag-list-wrapper .tag4:hover,.tag-list-wrapper .tag4.active,html[data-theme=dark] .tag-list-wrapper .tag4{background:#239d56}html[data-theme=dark] .tag-list-wrapper .tag4:hover,html[data-theme=dark] .tag-list-wrapper .tag4.active{background:#2bbe69}.tag-list-wrapper .tag5{background:#13c3c3}.tag-list-wrapper .tag5:hover,.tag-list-wrapper .tag5.active,html[data-theme=dark] .tag-list-wrapper .tag5{background:#0f9d9d}html[data-theme=dark] .tag-list-wrapper .tag5:hover,html[data-theme=dark] .tag-list-wrapper .tag5.active{background:#13c3c3}.tag-list-wrapper .tag6{background:#0a7bf4}.tag-list-wrapper .tag6:hover,.tag-list-wrapper .tag6.active,html[data-theme=dark] .tag-list-wrapper .tag6{background:#0968ce}html[data-theme=dark] .tag-list-wrapper .tag6:hover,html[data-theme=dark] .tag-list-wrapper .tag6.active{background:#0a7bf4}.tag-list-wrapper .tag7{background:#b37deb}.tag-list-wrapper .tag7:hover,.tag-list-wrapper .tag7.active,html[data-theme=dark] .tag-list-wrapper .tag7{background:#a160e7}html[data-theme=dark] .tag-list-wrapper .tag7:hover,html[data-theme=dark] .tag-list-wrapper .tag7.active{background:#b37deb}.tag-list-wrapper .tag8{background:#ed44a1}.tag-list-wrapper .tag8:hover,.tag-list-wrapper .tag8.active,html[data-theme=dark] .tag-list-wrapper .tag8{background:#ea2290}html[data-theme=dark] .tag-list-wrapper .tag8:hover,html[data-theme=dark] .tag-list-wrapper .tag8.active{background:#ed44a1}.timeline-wrapper{--dot-color: #fff;--dot-bar-color: #eaecef;--dot-border-color: #ddd;max-width:740px;margin:0 auto;padding:40px 0}@media (max-width: 719px){.timeline-wrapper{margin:0 1.2rem}}html[data-theme=dark] .timeline-wrapper{--dot-color: #444;--dot-bar-color: #333;--dot-border-color: #555}.timeline-wrapper #toc{inset-inline:unset 0;min-width:0}.timeline-wrapper .toc-wrapper{position:relative;z-index:10}.timeline-wrapper .timeline-content{position:relative;box-sizing:border-box;padding-inline-start:76px;list-style:none}.timeline-wrapper .timeline-content:after{content:" ";position:absolute;top:14px;inset-inline-start:64px;z-index:-1;width:4px;height:calc(100% - 38px);margin-inline-end:-2px;background:var(--dot-bar-color);transition:background var(--color-transition)}.timeline-wrapper .motto{position:relative;color:var(--text-color);font-size:18px;transition:color var(--color-transition)}@media (min-width: 1280px){.timeline-wrapper .motto{font-size:20px}}.timeline-wrapper .motto:before{content:" ";position:absolute;top:50%;z-index:2;margin-top:-6px;margin-inline-start:-6px;border:2px solid var(--dot-border-color);border-radius:50%;background:var(--dot-color);transition:background var(--color-transition),border-color var(--color-transition);inset-inline-start:-10px;width:8px;height:8px}.timeline-wrapper .timeline-year-title{margin-top:calc(3rem - var(--navbar-height));margin-bottom:.5rem;padding-top:var(--navbar-height);color:var(--text-color);font-weight:700;font-size:26px;font-family:var(--font-family-heading);transition:color var(--color-transition)}.timeline-wrapper .timeline-year-title span{position:relative}.timeline-wrapper .timeline-year-title span:before{content:" ";position:absolute;top:50%;z-index:2;margin-top:-6px;margin-inline-start:-6px;border:2px solid var(--dot-border-color);border-radius:50%;background:var(--dot-color);transition:background var(--color-transition),border-color var(--color-transition);inset-inline-start:-10px;width:8px;height:8px}.timeline-wrapper .timeline-year-wrapper{padding-inline-start:0!important}.timeline-wrapper .timeline-date{position:absolute;inset-inline-end:calc(100% + 24px);width:50px;font-size:14px;line-height:30px;text-align:end}.timeline-wrapper .timeline-date:before{content:" ";position:absolute;top:50%;z-index:2;margin-top:-6px;margin-inline-start:-6px;border:2px solid var(--dot-border-color);border-radius:50%;background:var(--dot-color);transition:background var(--color-transition),border-color var(--color-transition);inset-inline-end:-19px;width:6px;height:6px}.timeline-wrapper .timeline-title{position:relative;display:block;color:inherit;font-size:16px;line-height:30px;transition:color var(--color-transition),font-size var(--transform-transition)}.timeline-wrapper .timeline-item{position:relative;z-index:3;display:flex;padding:30px 0 10px;border-bottom:1px dashed var(--border-color);list-style:none;transition:border-color var(--color-transition)}.timeline-wrapper .timeline-item:hover{cursor:pointer}.timeline-wrapper .timeline-item:hover .timeline-date{font-size:16px;transition:border-color var(--color-transition),color var(--color-transition),font-size var(--transform-transition)}.timeline-wrapper .timeline-item:hover .timeline-date:before{border-color:var(--theme-color);background:var(--bg-color-secondary)}.timeline-wrapper .timeline-item:hover .timeline-title{color:var(--theme-color);font-size:18px}.timeline-list-wrapper{--dot-color: #fff;--dot-bar-color: #eaecef;--dot-border-color: #ddd;padding:8px 0}html[data-theme=dark] .timeline-list-wrapper{--dot-color: #444;--dot-bar-color: #333;--dot-border-color: #555}.timeline-list-wrapper .timeline-list-title{cursor:pointer}.timeline-list-wrapper .timeline-list-title .icon{position:relative;bottom:-.125rem;width:16px;height:16px;margin:0 6px}.timeline-list-wrapper .timeline-list-title .num{position:relative;margin:0 2px;font-size:22px}.timeline-list-wrapper .timeline-content{overflow-y:auto;max-height:80vh}.timeline-list-wrapper .timeline-content::-webkit-scrollbar-track-piece{background:transparent}.timeline-list-wrapper .timeline-list{position:relative;box-sizing:border-box;margin:0 8px;list-style:none}.timeline-list-wrapper .timeline-list:after{content:" ";position:absolute;top:14px;inset-inline-start:0;z-index:-1;width:4px;height:calc(100% - 14px);margin-inline-start:-2px;background:var(--dot-bar-color);transition:background var(--color-transition)}.timeline-list-wrapper .timeline-year{position:relative;margin:20px 0 0;color:var(--text-color);font-weight:700;font-size:20px}.timeline-list-wrapper .timeline-year:before{content:" ";position:absolute;z-index:2;border:1px solid var(--dot-border-color);border-radius:50%;background:var(--dot-color);transition:background var(--color-transition),border-color var(--color-transition);top:50%;inset-inline-start:-20px;width:8px;height:8px;margin-top:-4px;margin-inline-start:-4px}.timeline-list-wrapper .timeline-year-wrapper{padding-inline-start:0!important}.timeline-list-wrapper .timeline-date{display:inline-block;vertical-align:bottom;width:36px;font-size:12px;line-height:32px;transition:color var(--color-transition)}.timeline-list-wrapper .timeline-date:before{content:" ";position:absolute;z-index:2;border:1px solid var(--dot-border-color);border-radius:50%;background:var(--dot-color);transition:background var(--color-transition),border-color var(--color-transition);top:24px;inset-inline-start:-19px;width:6px;height:6px;margin-inline-start:-4px}.timeline-list-wrapper .timeline-title{color:inherit;font-size:14px;line-height:32px;cursor:pointer;transition:color var(--color-transition)}.timeline-list-wrapper .timeline-item{position:relative;display:flex;padding:12px 0 4px;border-bottom:1px dashed var(--border-color);list-style:none;transition:border-color var(--color-transition)}.timeline-list-wrapper .timeline-item:hover .timeline-date{color:var(--theme-color)}.timeline-list-wrapper .timeline-item:hover .timeline-date:before{border-color:var(--dot-color);background:var(--theme-color)}.timeline-list-wrapper .timeline-item:hover .timeline-title{color:var(--theme-color)}:root{--navbar-bg-color: var(--bg-color-float-blur);--sidebar-bg-color: var(--bg-color-blur)}html[data-theme=dark]{--navbar-bg-color: var(--bg-color-blur);--sidebar-bg-color: var(--bg-color-blur)}#app{--code-hl-bg-color: var(--code-highlight-line-color);--code-ln-color: var(--code-line-color);--code-ln-wrapper-width: var(--line-numbers-width);--code-tabs-nav-text-color: var(--code-color);--code-tabs-nav-bg-color: var(--code-border-color);--code-tabs-nav-hover-color: var(--code-highlight-line-color);--sidebar-space: var(--sidebar-width)}@media (max-width: 959px){#app{--navbar-height: var(--navbar-mobile-height);--navbar-vertical-padding: var(--navbar-mobile-vertical-padding);--navbar-horizontal-padding: var(--navbar-mobile-horizontal-padding);--sidebar-width: var(--sidebar-mobile-width)}}@media (min-width: 1440px){#app{--sidebar-space: clamp( var(--sidebar-width), max(0px, calc((100vw - var(--content-width)) / 2 - 2rem)) , 100vw )}}.DocSearch-Button,.DocSearch{--docsearch-primary-color: var(--vp-tc);--docsearch-text-color: var(--vp-c);--docsearch-highlight-color: var(--vp-tc);--docsearch-muted-color: var(--light-grey);--docsearch-container-background: rgb(9 10 17 / 80%);--docsearch-modal-background: var(--bg-color-float);--docsearch-searchbox-background: var(--bg-color-secondary);--docsearch-searchbox-focus-background: var(--vp-bg);--docsearch-searchbox-shadow: inset 0 0 0 2px var(--vp-tc);--docsearch-hit-color: var(--vp-cl);--docsearch-hit-active-color: var(--vp-bg);--docsearch-hit-background: var(--vp-bg);--docsearch-hit-shadow: 0 1px 3px 0 var(--border-color);--docsearch-footer-background: var(--vp-bg)}html[data-theme=dark] .DocSearch-Button,html[data-theme=dark] .DocSearch{--docsearch-logo-color: var(--vp-c);--docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;--docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 2px 2px 0 rgb(3 4 9 / 30%);--docsearch-key-gradient: linear-gradient(-225deg, #444950, #1c1e21);--docsearch-footer-shadow: inset 0 1px 0 0 rgb(73 76 106 / 50%), 0 -4px 8px 0 rgb(0 0 0 / 20%)}#nprogress{--nprogress-color: var(--vp-tc)}.search-box{--search-bg-color: var(--vp-bg);--search-accent-color: var(--vp-tc);--search-text-color: var(--vp-c);--search-border-color: var(--border-color);--search-item-text-color: var(--vp-clt);--search-item-focus-bg-color: var(--bg-color-secondary)}.external-link-icon{--external-link-icon-color: var(--light-grey)}html,body{margin:0;padding:0;background:#fff}html{font-size:16px;font-display:optional;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent}@media print{html{font-size:12pt}}body{min-height:100vh;color:#2c3e50}a{color:#3eaf7c;font-weight:500;text-decoration:none;overflow-wrap:break-word}kbd{display:inline-block;min-width:1em;margin-inline:.125rem;padding:.25em;border:1px solid #eee;border-radius:.25em;box-shadow:1px 1px 4px #00000026;line-height:1;letter-spacing:-.1em;text-align:center}code{margin:0;padding:.2rem .4rem;border-radius:5px;background:#7f7f7f1f;font-size:.85em;overflow-wrap:break-word}table code{padding:.1rem .4rem}p a code{color:#3eaf7c;font-weight:400}strong{font-weight:600}h1,h2,h3,h4,h5,h6{font-weight:500;line-height:1.25;overflow-wrap:break-word}h1:hover .header-anchor,h2:hover .header-anchor,h3:hover .header-anchor,h4:hover .header-anchor,h5:hover .header-anchor,h6:hover .header-anchor{opacity:1}h1{font-size:2rem}h2{padding-bottom:.3rem;border-bottom:1px solid #eaecef;font-size:1.65rem}h3{font-size:1.35rem}h4{font-size:1.15rem}h5{font-size:1.05rem}h6{font-size:1rem}a.header-anchor{float:left;margin-top:.125em;margin-inline-start:-.87em;padding-inline-end:.23em;font-size:.85em;opacity:0;transition:opacity .2s}@media print{a.header-anchor{display:none!important}}a.header-anchor:hover{text-decoration:none}a.header-anchor:focus-visible{opacity:1}p,ul,ol{line-height:1.6;overflow-wrap:break-word}@media print{p,ul,ol{line-height:1.5}}ul,ol{padding-inline-start:1.2em}blockquote{margin:1rem 0;padding:.25rem 0 .25rem 1rem;border-inline-start:.2rem solid #ddd;color:#666;font-size:1rem;overflow-wrap:break-word}blockquote>p{margin:0}hr{border:0;border-top:1px solid #eaecef}table{display:block;overflow-x:auto;margin:1rem 0;border-collapse:collapse}tr:nth-child(2n){background:#f6f8fa}th,td{padding:.6em 1em;border:1px solid #dfe2e5}pre{direction:ltr}@page{margin:2cm;font-size:12pt;size:a4}@media print{*,:after,:before{box-shadow:none!important;text-shadow:none!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}a{color:inherit;font-weight:inherit!important;font-size:inherit!important;text-decoration:underline}a[href^="http://"]:after,a[href^="https://"]:after{content:" (" attr(href) ") "}abbr[title]:after{content:" (" attr(title) ")"}pre{border:1px solid #eee;white-space:pre-wrap!important}pre>code{white-space:pre-wrap!important}blockquote{border-inline-start:.2rem solid #ddd;color:inherit}blockquote,pre{orphans:5;widows:5}img,tr,canvas{page-break-inside:avoid}}@font-face{font-weight:400;font-style:normal;font-family:Crimson;src:url(data:font/truetype;charset=utf-8;base64,AAEAAAANAIAAAwBQRkZUTYr5mwEAAAyMAAAAHEdERUYAKQATAAAMbAAAAB5PUy8yVsJ0MgAAAVgAAABgY21hcBiKDzgAAAHcAAABWGdhc3D//wADAAAMZAAAAAhnbHlmr+DBdQAAA1AAAAdsaGVhZBZwt+8AAADcAAAANmhoZWEFawEuAAABFAAAACRobXR4BksA9gAAAbgAAAAibG9jYQlsC24AAAM0AAAAHG1heHAAEQBZAAABOAAAACBuYW1lLaFDVAAACrwAAAFrcG9zdAC1AHoAAAwoAAAAPAABAAAAAQAAqBd2H18PPPUACwQAAAAAANqqufwAAAAA2qq5/AAb/9wB4QMeAAAACAACAAAAAAAAAAEAAAMs/ywAXAH9AAAAAAHhAAEAAAAAAAAAAAAAAAAAAAAEAAEAAAANAFkAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAH1AZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAIABgMAAAAAAAAAAAABEAAAAAAAAAAAAAAAUGZFZADAADAAOQMs/ywAXAMsANQAAAABAAAAAAMYAAAAAAAgAAEBpwAfAAAAAAFVAAAB/QAfAH0ALQA+ABsAPgAyACgAPgAxAAAAAAADAAAAAwAAABwAAQAAAAAAUgADAAEAAAAcAAQANgAAAAQABAABAAAAOf//AAAAL///AAAAAQAEAAAAAAADAAQABQAGAAcACAAJAAoACwAMAAABBgAAAQAAAAAAAAABAgAAAAIAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAwQFBgcICQoLDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACYAJgAmAGIAwAEeAZIBzgJAApYC2gNiA7YAAQAf/9wBhwMeABIAAAEGBwYHATAXFjM2NzY3ASYnJjcBgxwLCgH+zgMECxIKCgIBLgEDAwMDHhQFBgP85wMEAQgJBgMOAwMDEwAAAAIAH//9Ad0CkAAQACEAABMWFxYXNjc2NzQnJicGBwYHNyY3NjcWFxYXFAcGByYnJjcfATo6amo7OQE5OmxrOjkBXQIlJEE5IyIBIyJEOSQjAgFOkV5eBAReXoqJXl4EBF5eggJ0UlEDA09Qe3xVVgMDU1OEAAAAAAEAff/9AYACkQA+AAA3FAcGBwYHBiMGFQYXNjc2MzIXFhc2JzQnIicmJyY1JjURNjc2MSYnJicjBgcGBwYVFBUUFxYXNjc2NzIXFhXkAQEEBRgYDAMBBB4ZGhweGxofBAEDDBgZBQQBAQMEAQIDBAIFNTZCAgMDBA0XFw0LBQV3GBMVDAgEBAUKCgUCAQICAQIFCgoFBAQIDBUTGAGnLxkbBAYFAQIZGh4BAgECBQUEAwUHBwEICRYAAAAAAQAtAAAB0QKRADoAADcGFxYXITY3NjcmJyYjIgcGBwYHBisBNjc2NzY3NjUmJyYnBgcGBxQXFhc2NzY3FhcWFxYHBgcGBwYHLgEEAwMBYwURERADBwYFBAMDAg8VEx/LJkBAOhsQDwIxMkxSMjIHCAYGCSYmPTIfHwEBCgoeLkJBQg8EBQQCETAwKQICAgEBBCgUEylJSUYhJicsRDIzAgY1NRoEBQYBEyEhAwEjIjYlJCQtQlBQSAAAAAABAD7/+wG+ApEASgAANwYXFhcWFxYzNjc2NyYnJic2NzY3JicmIwYHBgcUFxYXNjc2NxYXFhcGBwYHBgcUFRQXNjc2NxYXFhcGBwYnIicmJyYnJiciBwYXPwEIBwUaHB0VZU5NBAMvLi8eIB4DAywsKzwrKxgEAwUIHR4wLRscAQMvLz8BAQYKEhEQNSYmAgImJSsWExQPCw0NFREMDQE7DgsLBQwFBgE8PWpMKSoGECQkMkAiIQIdHyUHBwcBCRscAwEbGSpCIyUOAgMCAwwIAwUEAQEoKD9XJSQBBQYODg8PAQ0NFQAAAgAb//oB4QKTACIAJQAANxQXFhchFRQXFjMyNzYjNTM2NzY1NCcmJyMRNCcmIwYHBgcBExEbAgMFASEJCRIdCAkBRgIBAQUEBTwFAwgHCQkG/vjmxgUGBgOwBQIBAwKzAgQDCBAMDQEBlAYGBgEICQf+cwEs/tQAAQA+//sBvgKTAEoAADcGFxYXFhcWMzY3NjcmJyYnIgcGBzY3NjczMjc2NzY3NjU0JyYnBgcGByMGBwYHFBcWMzY3NjMWFxYHBgcGJyInJicmJyYnIgcGFz8BCAcFGhwdFWVOTQQBMjJbFx8gFwoJCQlWKB0dFQ4JCAQDBQMdHSKXCREQEgMCBA4bGhNYJyUBAiYlKxYTFA8LDQ0VEQwNATsOCwsFDAUGATw9akU2NwMFBggrMC8uAgICExcZBgQCAgMBAwQBMVNUWAUFBAYFBAMxMTNZIyQBBQYODg8PAQ0NFQAAAgAy//oBzQKXACAAMwAANxQXFhc2NzY3NicmJyIHBgc2NzY3NCcmJwYHBgcGBwYXNyY3Njc2FxYXFgcGBwYHJicmNzM1NV5aOTsCAioqahoiIRsnWFhFAwIHQ0tMOTAZGQFbBAQaGxkXRB8fAQEfIDE9Hh4E511FRwQDPT1ZPEJBBQwLF4Y9PRMGCwwBEiwsPDZFRkkTHyAbCAcBAjAwREYsLQEFREVQAAAAAAEAKP/7AdUCiwApAAATFhcWMzI3Njc2NzYzIQYHBgcWFxYzMjcBNjc2NzQnJiMiBwYjIQYHBgcoAwYHAwYDAwELEBEdAQUJYWJXAQ8PDgcDAQ4LCQgBAQEEBhUVFv7JBgsNDAH6DQMCAQEFKRITFMjHjQcFBgMCPxYSEwoEAgMBAhkrKiAAAAADAD7/9wG/ApIAKABBAFgAADcGFxYXNjc2NyYnJicmJzQ3Njc2NyYnJiMGBwYHFhcWFxYVFAcGBwYHNyY3Njc2MzIzMhcyFxYXFhcGBwYHIicmNxMmNzY3FhcWFRQHBgcGByIjIicmJyY3PwE1M1ZQODgDAykpMQIBAyYlJQMCMC9HRjExAgIiIiMCAiMvLwNTBBQTKgEBAQECAQIBEjU1CAEdHjMrISICGAMYGSYvGxoTEx8CAQIBBAMfJCQBoU8tLQECMjFPOC4uGwIBAgEWJiU7SCYoAjEwQzopKhMBAgECEykpQAQsIiEbAQEBBywsQjUeHQEiI0QBZSMhIAECJiYvKh8gFAEBAhAfIEYAAAIAMf/6AcsClwAgADMAABMGFxYXMjc2NwYHBgcUFxYXNjc2NzY3NjUmJyYnBgcGBzcmNzY3FhcWFRQHBgcGJyYnJjc0AyopahoiIRsoV1hFAwIHQ0tMODEZGQE2NF5ZOjoBWgMfHzE9Hh4EGhoaF0QeHwUBy0dBQgUMCxeFPj0SBwsLAREsLD01RkVPV0dFBQQ8PU8UPCwtAQVFRUklIRsHCAECMDBPAAAADACWAAEAAAAAAAEABwAQAAEAAAAAAAIABwAoAAEAAAAAAAMABwBAAAEAAAAAAAQABwBYAAEAAAAAAAUAHgCeAAEAAAAAAAYABwDNAAMAAQQJAAEADgAAAAMAAQQJAAIADgAYAAMAAQQJAAMADgAwAAMAAQQJAAQADgBIAAMAAQQJAAUAPABgAAMAAQQJAAYADgC9AEMAcgBpAG0AcwBvAG4AAENyaW1zb24AAEMAcgBpAG0AcwBvAG4AAENyaW1zb24AAEMAcgBpAG0AcwBvAG4AAENyaW1zb24AAEMAcgBpAG0AcwBvAG4AAENyaW1zb24AAFYAZQByAHMAaQBvAG4AIAAxAC4AMAA7ACAARgBvAG4AdABFAGQAaQB0AG8AcgAgACgAdgAxAC4AMAApAABWZXJzaW9uIDEuMDsgRm9udEVkaXRvciAodjEuMCkAAEMAcgBpAG0AcwBvAG4AAENyaW1zb24AAAACAAAAAAAAADIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAABAAIAEwAUABUAFgAXABgAGQAaABsAHAAAAAH//wACAAEAAAAMAAAAFgAAAAIAAQADAAwAAQAEAAAAAgAAAAAAAAABAAAAANWkJwgAAAAA2qq5/AAAAADaqrn8) format("truetype")}html,body{background:var(--bg-color);transition:background var(--color-transition)}:root{color-scheme:light}html[data-theme=dark]{color-scheme:dark}body{color:var(--text-color);font-family:var(--font-family)}@media (min-width: 1440px){body{font-size:17px}}a{color:var(--theme-color)}kbd{border-color:var(--border-color-dark);background:var(--bg-color-secondary);font-family:var(--font-family-mono)}code{font-family:var(--font-family-mono);transition:background var(--color-transition),color var(--color-transition)}html[data-theme=dark] code{background:#333}p a code{color:var(--theme-color)}blockquote{border-color:#eee;color:#666;transition:border-color var(--color-transition),color var(--color-transition)}html[data-theme=dark] blockquote{border-color:#333}h1,h2,h3,h4,h5,h6{font-family:var(--font-family-heading)}@media (max-width: 419px){h1{font-size:1.9rem}}h2{border-color:var(--border-color);transition:border-bottom-color var(--color-transition)}hr{border-color:var(--border-color);transition:border-top-color var(--color-transition)}tr:nth-child(2n){background:var(--bg-color-secondary)}th,td{border-color:var(--border-color-dark)}@media print{@page{--text-color: #000 !important;--bg-color: #fff !important}div[class*=language-]{position:relative!important}}.theme-hope-content:not(.custom)>*:first-child{margin-top:0}.vp-breadcrumb{max-width:var(--content-width, 740px);margin-inline:auto;padding-inline:2.5rem;position:relative;z-index:2;padding-top:1rem;font-size:15px}@media (max-width: 959px){.vp-breadcrumb{padding-inline:1.5rem}}@media print{.vp-breadcrumb{max-width:unset}}@media (max-width: 959px){.vp-breadcrumb{font-size:14px}}@media (max-width: 419px){.vp-breadcrumb{padding-top:.5rem;font-size:12.8px}}@media print{.vp-breadcrumb{display:none}}.vp-breadcrumb .icon{margin-inline-end:.25em;font-size:1em}.vp-breadcrumb img.icon{vertical-align:-.125em;height:1em}.vp-breadcrumb a{display:inline-block;padding:0 .5em}.vp-breadcrumb a:before{position:relative;bottom:.125rem;margin-inline-end:.25em}.vp-breadcrumb a:hover{color:var(--theme-color)}.vp-breadcrumb ol{margin:0;padding-inline-start:0;list-style:none}.vp-breadcrumb li{display:inline-block;line-height:1.5}.vp-breadcrumb li:first-child a{padding-inline-start:0}.vp-breadcrumb li:last-child a{padding-inline-end:0}.vp-breadcrumb li.is-active a{color:var(--light-grey);cursor:default;pointer-events:none}.vp-breadcrumb li+li:before{content:"/";color:var(--light-grey)}.toggle-sidebar-wrapper{position:fixed;top:var(--navbar-height);bottom:0;inset-inline-start:var(--sidebar-space);z-index:100;display:flex;align-items:center;justify-content:center;font-size:2rem;transition:inset-inline-start var(--transform-transition)}@media (max-width: 719px){.toggle-sidebar-wrapper{display:none}}@media (min-width: 1440px){.toggle-sidebar-wrapper{display:none}}.toggle-sidebar-wrapper:hover{background:#7f7f7f0d;cursor:pointer}.toggle-sidebar-wrapper .arrow{display:inline-block;vertical-align:middle;width:1em;height:1em;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;line-height:normal;transition:all .3s}html[data-theme=dark] .toggle-sidebar-wrapper .arrow{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E")}.toggle-sidebar-wrapper .arrow.down{transform:rotate(180deg)}html[dir=rtl] .toggle-sidebar-wrapper .arrow.down{transform:rotate(-180deg)}.toggle-sidebar-wrapper .arrow.end{transform:rotate(90deg)}html[dir=rtl] .toggle-sidebar-wrapper .arrow.end,.toggle-sidebar-wrapper .arrow.start{transform:rotate(-90deg)}html[dir=rtl] .toggle-sidebar-wrapper .arrow.start{transform:rotate(90deg)}.theme-container{display:flex;flex-direction:column;justify-content:space-between;min-height:100vh}.theme-container .vp-page{padding-top:var(--navbar-height);padding-inline-start:calc(var(--sidebar-space) + 2rem)}@media (max-width: 719px){.theme-container .vp-page{padding-inline:0}}@media (min-width: 1440px){.theme-container .vp-page{padding-inline-end:calc(100vw - var(--content-width) - var(--sidebar-space) - 6rem)}}.theme-container .vp-sidebar{top:var(--navbar-height)}.theme-container.no-navbar .vp-page{padding-top:0}.theme-container.no-navbar .vp-sidebar{top:0}@media (max-width: 719px){.theme-container.no-navbar .vp-sidebar{top:0}}@media (max-width: 719px){.theme-container.hide-navbar .vp-sidebar{top:0}}.theme-container.sidebar-collapsed .vp-page{padding-inline-start:0}.theme-container.sidebar-collapsed .vp-sidebar{box-shadow:none;transform:translate(-100%)}html[dir=rtl] .theme-container.sidebar-collapsed .vp-sidebar{transform:translate(100%)}.theme-container.sidebar-collapsed .toggle-sidebar-wrapper{inset-inline-start:0}.theme-container.no-sidebar .vp-page{padding-inline:0}@media (min-width: 1440px){.theme-container.no-sidebar.has-toc .vp-page{padding-inline-end:16rem}}.theme-container.no-sidebar .vp-toggle-sidebar-button,.theme-container.no-sidebar .toggle-sidebar-wrapper,.theme-container.no-sidebar .vp-sidebar{display:none}.theme-container.sidebar-open .vp-sidebar{box-shadow:2px 0 8px var(--card-shadow);transform:translate(0)}.fade-slide-y-enter-active{transition:all .3s ease!important}.fade-slide-y-leave-active{transition:all .3s cubic-bezier(1,.5,.8,1)!important}.fade-slide-y-enter-from,.fade-slide-y-leave-to{opacity:0;transform:translateY(10px)}.vp-feature-wrapper{position:relative}.vp-feature-bg{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;background-attachment:fixed;background-position:50%;background-size:cover}.vp-feature-bg.light{display:inline-block}.vp-feature-bg.dark,html[data-theme=dark] .vp-feature-bg.light{display:none}html[data-theme=dark] .vp-feature-bg.dark{display:inline-block}.vp-feature{position:relative;z-index:1;margin:0 auto;padding:1.5rem 1rem;color:var(--text-color-lighter);text-align:center}.vp-feature-bg+.vp-feature{color:#222}html[data-theme=dark] .vp-feature-bg+.vp-feature{color:#eee}.vp-feature-bg+.vp-feature .icon{color:inherit}.vp-feature-image{height:10rem;margin:0 auto}@media (max-width: 959px){.vp-feature-image{height:8rem}}.vp-feature-image.light{display:inline-block}.vp-feature-image.dark,html[data-theme=dark] .vp-feature-image.light{display:none}html[data-theme=dark] .vp-feature-image.dark{display:inline-block}.vp-feature-header{margin-bottom:1.5rem;border-bottom:none;font-size:3rem;font-family:var(--font-family);text-align:center}@media (max-width: 959px){.vp-feature-header{font-size:2.5rem}}@media (max-width: 719px){.vp-feature-header{font-size:2.25rem}}@media (max-width: 419px){.vp-feature-header{font-size:2rem}}.vp-feature-description{font-size:1.125rem}.vp-features{z-index:1;display:flex;flex-wrap:wrap;align-items:stretch;place-content:stretch center;margin:1rem 0;text-align:start}@media print{.vp-features{display:block}}.vp-features:first-child{border-top:1px solid var(--border-color);transition:border-color var(--color-transition)}.vp-feature-item{position:relative;display:block;flex-basis:calc(33% - 3rem);margin:.5rem;padding:1rem;border-radius:.5rem;color:inherit;transition:background var(--color-transition),box-shadow var(--color-transition),transform var(--transform-transition)}@media (min-width: 1440px){.vp-feature-item{flex-basis:calc(25% - 3rem)}}@media (max-width: 959px){.vp-feature-item{flex-basis:calc(50% - 3rem)}}@media (max-width: 719px){.vp-feature-item{flex-basis:100%;font-size:.95rem}}@media (max-width: 419px){.vp-feature-item{margin:.5rem 0;font-size:.9rem}}.vp-feature-item.link{cursor:pointer}@media print{.vp-feature-item.link{text-decoration:none}}.vp-feature-item .icon{display:inline-block;height:1.1em;margin-inline-end:.5rem;color:var(--theme-color);font-weight:400;font-size:1.1em}.vp-feature-item:hover{background-color:var(--bg-color-secondary);box-shadow:0 2px 12px 0 var(--card-shadow);transform:translate(-2px,-2px);transform:scale(1.05)}.vp-feature-bg+.vp-feature .vp-feature-item:hover{background-color:transparent}.vp-feature-item:only-child{flex-basis:100%}.vp-feature-item:first-child:nth-last-child(2),.vp-feature-item:nth-child(2):last-child{flex-basis:calc(50% - 3rem)}@media (max-width: 719px){.vp-feature-item:first-child:nth-last-child(2),.vp-feature-item:nth-child(2):last-child{flex-basis:100%}}.vp-feature-title{margin:.25rem 0 .5rem;font-weight:700;font-size:1.3rem;font-family:var(--font-family)}@media (max-width: 419px){.vp-feature-title{font-size:1.2rem}}.vp-feature-details{margin:0;line-height:1.4}.vp-footer-wrapper{position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly;padding-block:.75rem;padding-inline:calc(var(--sidebar-space) + 2rem) 2rem;border-top:1px solid var(--border-color);background:var(--bg-color);color:var(--dark-grey);text-align:center;transition:border-top-color var(--color-transition),background var(--color-transition),padding var(--transform-transition)}@media (max-width: 719px){.vp-footer-wrapper{padding-inline-start:2rem}}@media (min-width: 1440px){.vp-footer-wrapper{z-index:50;padding-inline-start:2rem}}@media print{.vp-footer-wrapper{margin:0!important;padding:0!important}}@media (max-width: 419px){.vp-footer-wrapper{display:block}}.no-sidebar .vp-footer-wrapper,.sidebar-collapsed .vp-footer-wrapper{padding-inline-start:2rem}.vp-footer{margin:.5rem 1rem;font-size:14px}@media print{.vp-footer{display:none}}.vp-copyright{margin:6px 0;font-size:13px}.vp-page:not(.not-found)+.vp-footer-wrapper{margin-top:-2rem}.vp-hero-info-wrapper{position:relative;display:flex;align-items:center;justify-content:center;margin-inline:auto}.vp-hero-info-wrapper.fullscreen{height:calc(100vh - var(--navbar-height))!important}.vp-hero-info{z-index:1;width:100%;padding-inline:2.5rem}@media (max-width: 959px){.vp-hero-info{padding-inline:1.5rem}}@media (min-width: 959px){.vp-hero-info{display:flex;align-items:center;justify-content:space-evenly}}.vp-hero-mask{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;background-position:50%;background-size:cover}.vp-hero-mask:after{content:" ";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;display:block}.vp-hero-mask.light{display:block}html[data-theme=dark] .vp-hero-mask.light,.vp-hero-mask.dark{display:none}html[data-theme=dark] .vp-hero-mask.dark{display:block}.vp-hero-infos{z-index:1;margin:0 .5rem}.vp-hero-image{display:block;max-width:100%;max-height:18rem;margin:1rem}@media (max-width: 959px){.vp-hero-image{margin:2rem auto}}@media (max-width: 719px){.vp-hero-image{max-height:16rem;margin:1.5rem auto}}@media (max-width: 419px){.vp-hero-image{max-height:14rem}}.vp-hero-image.light{display:block}html[data-theme=dark] .vp-hero-image.light,.vp-hero-image.dark{display:none}html[data-theme=dark] .vp-hero-image.dark{display:block}#main-title{margin:.5rem 0;background:linear-gradient(120deg,var(--theme-color-light),var(--theme-color) 30%,#6229b9 100%);-webkit-background-clip:text;background-clip:text;font-weight:700;font-size:3.6rem;font-family:var(--font-family);line-height:1.5;-webkit-text-fill-color:transparent}@media (max-width: 719px){#main-title{margin:0}}@media (max-width: 959px){#main-title{font-size:2.5rem;text-align:center}}@media (max-width: 719px){#main-title{font-size:2.25rem;text-align:center}}@media (max-width: 419px){#main-title{margin:0 auto;font-size:2rem}}#main-description,.vp-hero-actions{margin:1.8rem 0}@media (max-width: 719px){#main-description,.vp-hero-actions{margin:1.5rem 0}}@media (max-width: 959px){#main-description,.vp-hero-actions{margin:1.5rem auto;text-align:center}}@media (max-width: 419px){#main-description,.vp-hero-actions{margin:1.2rem 0}}#main-description{max-width:35rem;color:var(--text-color-light);font-weight:500;font-size:1.6rem;line-height:1.3}@media (max-width: 719px){#main-description{font-size:1.4rem}}@media (max-width: 419px){#main-description{font-size:1.2rem}}.vp-hero-action{display:inline-block;overflow:hidden;min-width:4rem;margin:.5rem;padding:.5em 1.5rem;border-radius:2rem;background:var(--bg-color-secondary);color:var(--text-color);font-size:1.2rem;text-align:center;transition:color var(--color-transition),color var(--color-transition),transform var(--transform-transition)}@media (max-width: 719px){.vp-hero-action{padding:.5rem 1rem;font-size:1.1rem}}@media (max-width: 419px){.vp-hero-action{font-size:1rem}}@media print{.vp-hero-action{text-decoration:none}}.vp-hero-action:hover{background:var(--bg-color-tertiary)}.vp-hero-action.primary{border-color:var(--theme-color);background:var(--theme-color);color:var(--white)}.vp-hero-action.primary:hover{border-color:var(--theme-color-light);background:var(--theme-color-light)}.vp-project-home:not(.pure) .vp-hero-action:active{transform:scale(.96)}.vp-hero-action .icon{margin-inline-end:.25em}.vp-highlight-wrapper{position:relative;display:flex;align-items:center;justify-content:center}.vp-highlight-wrapper:nth-child(2n) .vp-highlight{flex-direction:row-reverse}.vp-highlight{z-index:1;display:flex;flex:1;align-items:center;justify-content:flex-end;max-width:var(--home-page-width);margin:0 auto;padding:1.5rem 2.5rem;color:#222}@media (max-width: 719px){.vp-highlight{display:block;padding-inline:1.5rem;text-align:center}}html[data-theme=dark] .vp-highlight{color:#eee}.vp-highlight-bg{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;background-attachment:fixed;background-position:50%;background-size:cover}.vp-highlight-bg.light{display:inline-block}.vp-highlight-bg.dark,html[data-theme=dark] .vp-highlight-bg.light{display:none}html[data-theme=dark] .vp-highlight-bg.dark{display:inline-block}.vp-highlight-image{width:12rem;margin:2rem 4rem}@media (max-width: 959px){.vp-highlight-image{width:10rem}}@media (max-width: 719px){.vp-highlight-image{width:8rem;margin:0 auto}}.vp-highlight-image.light{display:inline-block}.vp-highlight-image.dark,html[data-theme=dark] .vp-highlight-image.light{display:none}html[data-theme=dark] .vp-highlight-image.dark{display:inline-block}.vp-highlight-info-wrapper{display:flex;flex:1;justify-content:center;padding:2rem}@media (max-width: 719px){.vp-highlight-info-wrapper{padding:1rem 0}}.vp-highlight-info-wrapper:only-child{flex:1 0 100%}.vp-highlight-info{text-align:start}.vp-highlight-header{margin-bottom:1.5rem;border-bottom:none;font-size:3rem;font-family:var(--font-family)}@media (max-width: 959px){.vp-highlight-header{font-size:2.5rem}}@media (max-width: 719px){.vp-highlight-header{font-size:2.25rem;text-align:center}}@media (max-width: 419px){.vp-highlight-header{font-size:2rem}}.vp-highlight-description{font-size:1.125rem}.vp-highlights{margin-inline-start:-1.25em;padding-inline-start:0}.vp-highlight-item-wrapper{padding:.5em .5em .5em 1.75em;border-radius:.5rem;list-style:none}.vp-highlight-item-wrapper.link{cursor:pointer}.vp-highlight-item-wrapper:hover{background-color:var(--bg-color-secondary);box-shadow:0 2px 12px 0 var(--card-shadow);transition:transform var(--transform-transition);transform:translate(-2px,-2px)}.vp-highlight-bg+.vp-highlight .vp-highlight-item-wrapper:hover{background-color:transparent}.vp-highlight-item-wrapper::marker{font-weight:700}.vp-highlight-item{display:list-item;color:inherit;list-style:initial}@media print{.vp-highlight-item{text-decoration:none}}.vp-highlight-title{margin:0;font-weight:600;font-size:1.125rem;font-family:var(--font-family)}.vp-highlight-title .icon{margin-inline-end:.25em;font-size:1em}.vp-highlight-title img.icon{vertical-align:-.125em;height:1em}.vp-highlight-details{margin:.5rem 0 0}.vp-project-home{--content-width: var(--home-page-width);display:block;flex:1;padding-top:var(--navbar-height)}@media screen{.vp-project-home .vp-hero-info-wrapper:not(.fullscreen) .vp-hero-info{max-width:var(--home-page-width)}}@media screen{.vp-project-home .vp-feature{max-width:var(--home-page-width)}}.vp-project-home .theme-hope-content{padding-bottom:1.5rem!important}.vp-project-home .theme-hope-content:empty{padding:0!important}.not-found-hint{padding:2rem}.not-found-hint .error-code{margin:0;font-weight:700;font-size:4rem;line-height:4rem}.not-found-hint .error-title{font-weight:700}.not-found-hint .error-hint{margin:0;padding:12px 0;font-weight:600;font-size:20px;line-height:20px;letter-spacing:2px}.vp-page.not-found{display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;width:100vw;max-width:var(--home-page-width);margin:0 auto;padding:calc(var(--navbar-height) + 1rem) 1rem 1rem!important;text-align:center}.vp-page.not-found .action-button{display:inline-block;box-sizing:border-box;margin:.25rem;padding:.75rem 1rem;border-width:0;border-bottom:1px solid var(--theme-color-dark);border-radius:3rem;background:var(--theme-color);color:var(--white);outline:none;font-size:1rem;transition:background .1s ease}.vp-page.not-found .action-button:hover{background:var(--theme-color-light);cursor:pointer}.vp-page-nav{display:flex;flex-wrap:wrap;min-height:2rem;margin-top:0;padding-block:.5rem;padding-inline:2rem;border-top:1px solid var(--border-color);transition:border-top var(--color-transition)}@media (max-width: 959px){.vp-page-nav{padding-inline:1rem}}@media print{.vp-page-nav{display:none}}.vp-page-nav .nav-link{display:inline-block;flex-grow:1;margin:.25rem;padding:.25rem .5rem;border:1px solid var(--border-color);border-radius:.25rem}.vp-page-nav .nav-link:hover{background:var(--bg-color-secondary)}.vp-page-nav .nav-link .hint{color:var(--light-grey);font-size:.875rem;line-height:2}.vp-page-nav .nav-link .arrow{display:inline-block;vertical-align:middle;width:1em;height:1em;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;line-height:normal;transition:all .3s;font-size:.75rem}html[data-theme=dark] .vp-page-nav .nav-link .arrow{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E")}.vp-page-nav .nav-link .arrow.down{transform:rotate(180deg)}html[dir=rtl] .vp-page-nav .nav-link .arrow.down{transform:rotate(-180deg)}.vp-page-nav .nav-link .arrow.end{transform:rotate(90deg)}html[dir=rtl] .vp-page-nav .nav-link .arrow.end,.vp-page-nav .nav-link .arrow.start{transform:rotate(-90deg)}html[dir=rtl] .vp-page-nav .nav-link .arrow.start{transform:rotate(90deg)}.vp-page-nav .prev{text-align:start}.vp-page-nav .prev .icon{margin-inline-end:.25em;font-size:1em}.vp-page-nav .prev img.icon{vertical-align:-.125em;height:1em}.vp-page-nav .next{text-align:end}.vp-page-nav .next .icon{margin-inline-start:.25em;font-size:1em}.vp-page-nav .next img.icon{vertical-align:-.125em;height:1em}.vp-page-title{max-width:var(--content-width, 740px);margin-inline:auto;padding-inline:2.5rem;position:relative;z-index:1;padding-top:1rem;padding-bottom:0}@media (max-width: 959px){.vp-page-title{padding-inline:1.5rem}}@media print{.vp-page-title{max-width:unset}}@media print{.vp-page-title{padding-inline:0!important}}@media (max-width: 959px){.vp-page-title{padding-top:.5rem}}.vp-page-title h1{margin-top:calc(0px - var(--navbar-height))!important;margin-bottom:1rem;padding-top:var(--navbar-height)!important;font-size:2.2rem}@media (max-width: 959px){.vp-page-title h1{margin-bottom:.5rem}}.vp-page-title h1 .icon{margin-inline-end:.25em;color:var(--theme-color);font-size:.9em}.vp-page-title h1 img.icon{vertical-align:-.125em;height:1em}.theme-hope-content:not(.custom){padding-top:0!important}.theme-hope-content:not(.custom) h1:first-child,.theme-hope-content:not(.custom) h2:first-child,.theme-hope-content:not(.custom) h3:first-child,.theme-hope-content:not(.custom) h4:first-child,.theme-hope-content:not(.custom) h5:first-child,.theme-hope-content:not(.custom) h6:first-child{margin-top:calc(.5rem - var(--navbar-height))!important;padding-top:var(--navbar-height)!important}.theme-hope-content:not(.custom)>h1:first-child{display:none}.vp-page{display:block;flex-grow:1;padding-bottom:2rem;transition:padding var(--transform-transition)}@media print{.vp-page{min-height:auto!important;margin:0!important;padding:0!important}}.page-cover{width:var(--content-width);margin-inline:auto}@media (max-width: 719px){.page-cover{width:100%}}.page-cover img{-o-object-fit:cover;object-fit:cover;width:100%;max-height:25vh;border-radius:.5rem}@media (max-width: 719px){.page-cover img{border-radius:0}}.vp-skip-link{top:.25rem;inset-inline-start:.25rem;z-index:999;padding:.65rem 1.5rem;border-radius:.5rem;background:var(--bg-color);color:var(--theme-color);box-shadow:var(--card-shadow);font-weight:700;font-size:.9em;text-decoration:none}@media print{.vp-skip-link{display:none}}.vp-skip-link:focus{clip:auto;width:auto;height:auto;-webkit-clip-path:none;clip-path:none}.theme-hope-content pre{overflow:auto;margin:.85rem 0;padding:1rem;border-radius:6px;line-height:1.375}.theme-hope-content pre code{padding:0;border-radius:0;background:transparent!important;color:var(--code-color);font-family:var(--font-family-mono);text-align:left;white-space:pre;word-spacing:normal;word-wrap:normal;word-break:normal;overflow-wrap:unset;-webkit-hyphens:none;hyphens:none;transition:color var(--color-transition);-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}@media print{.theme-hope-content pre code{white-space:pre-wrap}}.theme-hope-content .line-number{font-family:var(--font-family-mono)}div[class*=language-]{position:relative;border-radius:6px;background:var(--code-bg-color);font-size:16px;transition:background var(--color-transition)}@media (max-width: 419px){.theme-hope-content>div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}div[class*=language-]:before{content:attr(data-ext);position:absolute;top:0;right:1em;z-index:3;color:var(--code-line-color);font-size:.75rem;transition:color var(--color-transition)}div[class*=language-] pre{position:relative;z-index:1;scrollbar-gutter:stable}div[class*=language-] .highlight-lines{position:absolute;top:0;bottom:0;left:0;width:100%;padding:1rem 0;line-height:1.375;-webkit-user-select:none;-moz-user-select:none;user-select:none}div[class*=language-] .highlight-line{background:var(--code-highlight-line-color);transition:background var(--color-transition)}div[class*=language-].line-numbers-mode:after{content:"";position:absolute;top:0;bottom:0;left:0;z-index:2;width:var(--line-numbers-width);border-right:1px solid var(--code-highlight-line-color);border-radius:6px 0 0 6px;transition:border-color var(--color-transition)}@media (max-width: 419px){div[class*=language-].line-numbers-mode:after{border-radius:0}}@media print{div[class*=language-].line-numbers-mode:after{display:none}}div[class*=language-].line-numbers-mode .highlight-line{position:relative}div[class*=language-].line-numbers-mode .highlight-line:before{content:" ";position:absolute;top:0;left:0;z-index:3;display:block;width:var(--line-numbers-width);height:100%}div[class*=language-].line-numbers-mode pre{vertical-align:middle;margin-left:var(--line-numbers-width);padding-left:.5rem}@media print{div[class*=language-].line-numbers-mode pre{margin-left:0;padding-left:1rem}}div[class*=language-].line-numbers-mode .line-numbers{position:absolute;top:0;bottom:0;left:0;display:flex;flex-direction:column;width:var(--line-numbers-width);padding:1rem 0;color:var(--code-line-color);counter-reset:line-number;text-align:center;transition:color var(--color-transition)}@media print{div[class*=language-].line-numbers-mode .line-numbers{display:none}}div[class*=language-].line-numbers-mode .line-number{position:relative;z-index:4;display:flex;flex:1;align-items:center;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none}div[class*=language-].line-numbers-mode .line-number:before{content:counter(line-number);display:block;font-size:.8em;line-height:1;counter-increment:line-number}div[class*=language-]:not(.line-numbers-mode) .line-numbers{display:none}html[data-theme=light] #app{--code-color: #383a42;--code-line-color: rgba(56, 58, 66, .67);--code-bg-color: #ecf4fa;--code-border-color: #c3def3;--code-highlight-line-color: #d8e9f6}html[data-theme=light] code[class*=language-],html[data-theme=light] pre[class*=language-]{-moz-tab-size:2;-o-tab-size:2;tab-size:2}html[data-theme=light] code[class*=language-]::-moz-selection,html[data-theme=light] code[class*=language-] ::-moz-selection,html[data-theme=light] pre[class*=language-]::-moz-selection,html[data-theme=light] pre[class*=language-] ::-moz-selection{background:#e5e5e6;color:inherit}html[data-theme=light] code[class*=language-]::selection,html[data-theme=light] code[class*=language-] ::selection,html[data-theme=light] pre[class*=language-]::selection,html[data-theme=light] pre[class*=language-] ::selection{background:#e5e5e6;color:inherit}html[data-theme=light] .token.comment,html[data-theme=light] .token.prolog,html[data-theme=light] .token.cdata{color:#a0a1a7}html[data-theme=light] .token.doctype,html[data-theme=light] .token.punctuation,html[data-theme=light] .token.entity{color:#383a42}html[data-theme=light] .token.attr-name,html[data-theme=light] .token.class-name,html[data-theme=light] .token.boolean,html[data-theme=light] .token.constant,html[data-theme=light] .token.number,html[data-theme=light] .token.atrule{color:#b76b01}html[data-theme=light] .token.keyword{color:#a626a4}html[data-theme=light] .token.property,html[data-theme=light] .token.tag,html[data-theme=light] .token.symbol,html[data-theme=light] .token.deleted,html[data-theme=light] .token.important{color:#e45649}html[data-theme=light] .token.selector,html[data-theme=light] .token.string,html[data-theme=light] .token.char,html[data-theme=light] .token.builtin,html[data-theme=light] .token.inserted,html[data-theme=light] .token.regex,html[data-theme=light] .token.attr-value,html[data-theme=light] .token.attr-value>.token.punctuation{color:#50a14f}html[data-theme=light] .token.variable,html[data-theme=light] .token.operator,html[data-theme=light] .token.function{color:#4078f2}html[data-theme=light] .token.url{color:#0184bc}html[data-theme=light] .token.attr-value>.token.punctuation.attr-equals,html[data-theme=light] .token.special-attr>.token.attr-value>.token.value.css{color:#383a42}html[data-theme=light] .language-css .token.selector{color:#e45649}html[data-theme=light] .language-css .token.property{color:#383a42}html[data-theme=light] .language-css .token.function,html[data-theme=light] .language-css .token.url>.token.function{color:#0184bc}html[data-theme=light] .language-css .token.url>.token.string.url{color:#50a14f}html[data-theme=light] .language-css .token.important,html[data-theme=light] .language-css .token.atrule .token.rule,html[data-theme=light] .language-javascript .token.operator{color:#a626a4}html[data-theme=light] .language-javascript .token.template-string>.token.interpolation>.token.interpolation-punctuation.punctuation{color:#ca1243}html[data-theme=light] .language-json .token.operator{color:#383a42}html[data-theme=light] .language-json .token.null.keyword{color:#b76b01}html[data-theme=light] .language-markdown .token.url,html[data-theme=light] .language-markdown .token.url>.token.operator,html[data-theme=light] .language-markdown .token.url-reference.url>.token.string{color:#383a42}html[data-theme=light] .language-markdown .token.url>.token.content{color:#4078f2}html[data-theme=light] .language-markdown .token.url>.token.url,html[data-theme=light] .language-markdown .token.url-reference.url{color:#0184bc}html[data-theme=light] .language-markdown .token.blockquote.punctuation,html[data-theme=light] .language-markdown .token.hr.punctuation{color:#a0a1a7;font-style:italic}html[data-theme=light] .language-markdown .token.code-snippet{color:#50a14f}html[data-theme=light] .language-markdown .token.bold .token.content{color:#b76b01}html[data-theme=light] .language-markdown .token.italic .token.content{color:#a626a4}html[data-theme=light] .language-markdown .token.strike .token.content,html[data-theme=light] .language-markdown .token.strike .token.punctuation,html[data-theme=light] .language-markdown .token.list.punctuation,html[data-theme=light] .language-markdown .token.title.important>.token.punctuation{color:#e45649}html[data-theme=light] .token.bold{font-weight:700}html[data-theme=light] .token.comment,html[data-theme=light] .token.italic{font-style:italic}html[data-theme=light] .token.entity{cursor:help}html[data-theme=light] .token.namespace{opacity:.8}html[data-theme=dark] #app{--code-color: #abb2bf;--code-line-color: rgba(171, 178, 191, .67);--code-bg-color: #282c34;--code-border-color: #343e51;--code-highlight-line-color: #2f3542}html[data-theme=dark] code[class*=language-],html[data-theme=dark] pre[class*=language-]{text-shadow:0 1px rgba(0,0,0,.3);-moz-tab-size:2;-o-tab-size:2;tab-size:2}@media print{html[data-theme=dark] code[class*=language-],html[data-theme=dark] pre[class*=language-]{text-shadow:none}}html[data-theme=dark] code[class*=language-]::-moz-selection,html[data-theme=dark] code[class*=language-] ::-moz-selection,html[data-theme=dark] pre[class*=language-]::-moz-selection,html[data-theme=dark] pre[class*=language-] ::-moz-selection{background:#3e4451;color:inherit;text-shadow:none}html[data-theme=dark] code[class*=language-]::selection,html[data-theme=dark] code[class*=language-] ::selection,html[data-theme=dark] pre[class*=language-]::selection,html[data-theme=dark] pre[class*=language-] ::selection{background:#3e4451;color:inherit;text-shadow:none}html[data-theme=dark] .token.comment,html[data-theme=dark] .token.prolog,html[data-theme=dark] .token.cdata{color:#5c6370}html[data-theme=dark] .token.doctype,html[data-theme=dark] .token.punctuation,html[data-theme=dark] .token.entity{color:#abb2bf}html[data-theme=dark] .token.attr-name,html[data-theme=dark] .token.class-name,html[data-theme=dark] .token.boolean,html[data-theme=dark] .token.constant,html[data-theme=dark] .token.number,html[data-theme=dark] .token.atrule{color:#d19a66}html[data-theme=dark] .token.keyword{color:#c678dd}html[data-theme=dark] .token.property,html[data-theme=dark] .token.tag,html[data-theme=dark] .token.symbol,html[data-theme=dark] .token.deleted,html[data-theme=dark] .token.important{color:#e06c75}html[data-theme=dark] .token.selector,html[data-theme=dark] .token.string,html[data-theme=dark] .token.char,html[data-theme=dark] .token.builtin,html[data-theme=dark] .token.inserted,html[data-theme=dark] .token.regex,html[data-theme=dark] .token.attr-value,html[data-theme=dark] .token.attr-value>.token.punctuation{color:#98c379}html[data-theme=dark] .token.variable,html[data-theme=dark] .token.operator,html[data-theme=dark] .token.function{color:#61afef}html[data-theme=dark] .token.url{color:#56b6c2}html[data-theme=dark] .token.attr-value>.token.punctuation.attr-equals,html[data-theme=dark] .token.special-attr>.token.attr-value>.token.value.css{color:#abb2bf}html[data-theme=dark] .language-css .token.selector{color:#e06c75}html[data-theme=dark] .language-css .token.property{color:#abb2bf}html[data-theme=dark] .language-css .token.function,html[data-theme=dark] .language-css .token.url>.token.function{color:#56b6c2}html[data-theme=dark] .language-css .token.url>.token.string.url{color:#98c379}html[data-theme=dark] .language-css .token.important,html[data-theme=dark] .language-css .token.atrule .token.rule,html[data-theme=dark] .language-javascript .token.operator{color:#c678dd}html[data-theme=dark] .language-javascript .token.template-string>.token.interpolation>.token.interpolation-punctuation.punctuation{color:#be5046}html[data-theme=dark] .language-json .token.operator{color:#abb2bf}html[data-theme=dark] .language-json .token.null.keyword{color:#d19a66}html[data-theme=dark] .language-markdown .token.url,html[data-theme=dark] .language-markdown .token.url>.token.operator,html[data-theme=dark] .language-markdown .token.url-reference.url>.token.string{color:#abb2bf}html[data-theme=dark] .language-markdown .token.url>.token.content{color:#61afef}html[data-theme=dark] .language-markdown .token.url>.token.url,html[data-theme=dark] .language-markdown .token.url-reference.url{color:#56b6c2}html[data-theme=dark] .language-markdown .token.blockquote.punctuation,html[data-theme=dark] .language-markdown .token.hr.punctuation{color:#5c6370;font-style:italic}html[data-theme=dark] .language-markdown .token.code-snippet{color:#98c379}html[data-theme=dark] .language-markdown .token.bold .token.content{color:#d19a66}html[data-theme=dark] .language-markdown .token.italic .token.content{color:#c678dd}html[data-theme=dark] .language-markdown .token.strike .token.content,html[data-theme=dark] .language-markdown .token.strike .token.punctuation,html[data-theme=dark] .language-markdown .token.list.punctuation,html[data-theme=dark] .language-markdown .token.title.important>.token.punctuation{color:#e06c75}html[data-theme=dark] .token.bold{font-weight:700}html[data-theme=dark] .token.comment,html[data-theme=dark] .token.italic{font-style:italic}html[data-theme=dark] .token.entity{cursor:help}html[data-theme=dark] .token.namespace{opacity:.8}.sr-only{position:absolute;overflow:hidden;clip:rect(0,0,0,0);width:1px;height:1px;margin:-1px;padding:0;border-width:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none}@media print{.theme-hope-content{margin:0!important;padding-inline:0!important}}.theme-hope-content.custom{margin:0;padding:0}.theme-hope-content:not(.custom){max-width:var(--content-width, 740px);margin:0 auto;padding:2rem 2.5rem;padding-top:0}@media (max-width: 959px){.theme-hope-content:not(.custom){padding:1.5rem}}@media (max-width: 419px){.theme-hope-content:not(.custom){padding:1rem 1.5rem}}@media print{.theme-hope-content:not(.custom){max-width:unset}}.theme-hope-content:not(.custom)>h1,.theme-hope-content:not(.custom)>h2,.theme-hope-content:not(.custom)>h3,.theme-hope-content:not(.custom)>h4,.theme-hope-content:not(.custom)>h5,.theme-hope-content:not(.custom)>h6{margin-top:calc(.5rem - var(--navbar-height));margin-bottom:.5rem;padding-top:calc(1rem + var(--navbar-height));outline:none}.theme-container.no-navbar .theme-hope-content:not(.custom)>h1,.theme-container.no-navbar .theme-hope-content:not(.custom)>h2,.theme-container.no-navbar .theme-hope-content:not(.custom)>h3,.theme-container.no-navbar .theme-hope-content:not(.custom)>h4,.theme-container.no-navbar .theme-hope-content:not(.custom)>h5,.theme-container.no-navbar .theme-hope-content:not(.custom)>h6{margin-top:1.5rem;padding-top:0}.theme-hope-content:not(.custom)>p,.theme-hope-content:not(.custom)>ul p,.theme-hope-content:not(.custom)>ol p{text-align:justify;overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto}@media (max-width: 419px){.theme-hope-content:not(.custom)>p,.theme-hope-content:not(.custom)>ul p,.theme-hope-content:not(.custom)>ol p{text-align:start}}@media print{.theme-hope-content:not(.custom)>p,.theme-hope-content:not(.custom)>ul p,.theme-hope-content:not(.custom)>ol p{text-align:start}}.theme-hope-content a:hover{text-decoration:underline}.theme-hope-content img{max-width:100%}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}html[data-theme=light]::view-transition-old(root),html[data-theme=dark]::view-transition-new(root){z-index:1}html[data-theme=light]::view-transition-new(root),html[data-theme=dark]::view-transition-old(root){z-index:99999}@media (min-width: 1280px){.chart-wrapper::-webkit-scrollbar,.flowchart-wrapper::-webkit-scrollbar,.mermaid-wrapper::-webkit-scrollbar{width:8px;height:8px}.chart-wrapper::-webkit-scrollbar-track-piece,.flowchart-wrapper::-webkit-scrollbar-track-piece,.mermaid-wrapper::-webkit-scrollbar-track-piece{border-radius:8px;background:#0000001a}}html[dir=rtl] a.header-anchor{float:right}#docsearch-container{min-width:145.7px!important}@media (max-width: 959px){#docsearch-container{min-width:36px!important}}.DocSearch.DocSearch-Button{margin-left:0}@media (max-width: 959px){.DocSearch.DocSearch-Button{min-width:36px!important}}.DocSearch .DocSearch-Button-Placeholder{display:inline-block;padding:4px 12px 4px 6px;font-size:14px}@media (max-width: 719px){.DocSearch .DocSearch-Button-Placeholder{display:none}}.DocSearch .DocSearch-Search-Icon{width:1.25em;height:1.25em}@media (max-width: 959px){.DocSearch .DocSearch-Button-Keys{display:none}}.DocSearch .DocSearch-Button-Key{background:var(--bg-color);box-shadow:none}:root{scrollbar-width:thin}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track-piece{border-radius:6px;background:#0000001a}::-webkit-scrollbar-thumb{border-radius:6px;background:var(--theme-color)}::-webkit-scrollbar-thumb:active{background:var(--theme-color-light)}@media (max-width: 719px){.hide-in-mobile{display:none!important}}@media (max-width: 959px){.hide-in-pad{display:none!important}}.page-author-item{display:inline-block;margin:0 4px;font-weight:400;overflow-wrap:break-word}.page-category-info{flex-wrap:wrap}.page-category-item{display:inline-block;margin:.125em .25em;padding:0 .25em;border-radius:.25em;background:var(--bg-color-secondary);color:var(--text-color-light);font-weight:700;font-size:.75rem;line-height:2;transition:background var(--color-transition),color var(--color-transition)}@media print{.page-category-item{padding:0;font-weight:400}.page-category-item:after{content:", "}.page-category-item:last-of-type:after{content:""}}.page-category-item.clickable>span:hover{color:var(--theme-color);cursor:pointer}.page-category-item.category0{background:#fde5e7;color:#ec2f3e}html[data-theme=dark] .page-category-item.category0{background:#340509;color:#ba111f}.page-category-item.category0:hover{background:#f9bec3}html[data-theme=dark] .page-category-item.category0:hover{background:#53080e}.page-category-item.category1{background:#ffeee8;color:#fb7649}html[data-theme=dark] .page-category-item.category1{background:#441201;color:#f54205}.page-category-item.category1:hover{background:#fed4c6}html[data-theme=dark] .page-category-item.category1:hover{background:#6d1d02}.page-category-item.category2{background:#fef5e7;color:#f5b041}html[data-theme=dark] .page-category-item.category2{background:#3e2703;color:#e08e0b}.page-category-item.category2:hover{background:#fce6c4}html[data-theme=dark] .page-category-item.category2:hover{background:#633f05}.page-category-item.category3{background:#eafaf1;color:#55d98d}html[data-theme=dark] .page-category-item.category3{background:#0c331c;color:#29b866}.page-category-item.category3:hover{background:#caf3db}html[data-theme=dark] .page-category-item.category3:hover{background:#12522d}.page-category-item.category4{background:#e6f9ee;color:#36d278}html[data-theme=dark] .page-category-item.category4{background:#092917;color:#219552}.page-category-item.category4:hover{background:#c0f1d5}html[data-theme=dark] .page-category-item.category4:hover{background:#0f4224}.page-category-item.category5{background:#e1fcfc;color:#16e1e1}html[data-theme=dark] .page-category-item.category5{background:#042929;color:#0e9595}.page-category-item.category5:hover{background:#b4f8f8}html[data-theme=dark] .page-category-item.category5:hover{background:#064242}.page-category-item.category6{background:#e4f0fe;color:#2589f6}html[data-theme=dark] .page-category-item.category6{background:#021b36;color:#0862c3}.page-category-item.category6:hover{background:#bbdafc}html[data-theme=dark] .page-category-item.category6:hover{background:#042c57}.page-category-item.category7{background:#f7f1fd;color:#bb8ced}html[data-theme=dark] .page-category-item.category7{background:#2a0b4b;color:#9851e4}.page-category-item.category7:hover{background:#eadbfa}html[data-theme=dark] .page-category-item.category7:hover{background:#431277}.page-category-item.category8{background:#fdeaf5;color:#ef59ab}html[data-theme=dark] .page-category-item.category8{background:#400626;color:#e81689}.page-category-item.category8:hover{background:#facbe5}html[data-theme=dark] .page-category-item.category8:hover{background:#670a3d}.page-original-info{position:relative;display:inline-block;vertical-align:middle;overflow:hidden;padding:0 .5em;border:.5px solid var(--dark-grey);border-radius:.75em;background:var(--bg-color);font-size:.75em;line-height:1.5!important}.page-info{display:flex;flex-wrap:wrap;align-items:center;place-content:stretch flex-start;color:var(--dark-grey);font-size:14px}@media print{.page-info{display:flex!important}}.page-info>span{display:flex;align-items:center;max-width:100%;margin-inline-end:.5em;line-height:2}@media (min-width: 1440px){.page-info>span{font-size:1.1em}}@media (max-width: 419px){.page-info>span{margin-inline-end:.3em;font-size:.875em}}@media print{.page-info>span{display:flex!important}}.page-info .icon{position:relative;display:inline-block;vertical-align:middle;width:1em;height:1em;margin-inline-end:.25em}.page-info a{color:inherit}.page-info a:hover,.page-info a:active{color:var(--theme-color)}.page-meta{max-width:var(--content-width, 740px);margin-inline:auto;padding-inline:2.5rem;display:flex;flex-wrap:wrap;justify-content:space-between;overflow:auto;padding-top:.75rem;padding-bottom:.75rem}@media (max-width: 959px){.page-meta{padding-inline:1.5rem}}@media print{.page-meta{max-width:unset}}@media print{.page-meta{margin:0!important;padding-inline:0!important}}@media (max-width: 719px){.page-meta{display:block}}.page-meta .meta-item{flex-grow:1}.page-meta .meta-item .label{font-weight:500}.page-meta .meta-item .label:not(a){color:var(--text-color-lighter)}.page-meta .meta-item .info{color:var(--dark-grey);font-weight:400}.page-meta .git-info{text-align:end}.page-meta .edit-link{margin-top:.25rem;margin-bottom:.25rem;margin-inline-end:.5rem;font-size:14px}@media print{.page-meta .edit-link{display:none}}.page-meta .edit-link .icon{position:relative;bottom:-.125em;width:1em;height:1em;margin-inline-end:.25em}.page-meta .update-time,.page-meta .contributors{margin-top:.25rem;margin-bottom:.25rem;font-size:14px}@media (max-width: 719px){.page-meta .update-time,.page-meta .contributors{font-size:13px;text-align:start}}.print-button{border-width:0;background:transparent;cursor:pointer;box-sizing:content-box;width:1rem;height:1rem;padding:.5rem;border-radius:.25em;color:inherit;font-size:1rem;transform:translateY(.25rem)}@media print{.print-button{display:none}}.page-tag-info{flex-wrap:wrap}.page-tag-item{position:relative;display:inline-block;vertical-align:middle;overflow:hidden;min-width:1.5rem;margin:.125rem;padding:.125rem .25rem .125rem .625rem;background:var(--bg-color-secondary);background:linear-gradient(135deg,transparent .75em,var(--bg-color-secondary) 0) top,linear-gradient(45deg,transparent .75em,var(--bg-color-secondary) 0) bottom;background-size:100% 52%!important;background-repeat:no-repeat!important;color:var(--text-color-light);font-weight:700;font-size:.625rem;line-height:1.5;text-align:center;transition:background var(--color-transition),color var(--color-transition)}@media print{.page-tag-item{padding:0;font-weight:400}.page-tag-item:after{content:", "}.page-tag-item:last-of-type:after{content:""}}.page-tag-item.clickable:hover{cursor:pointer}.page-tag-item.tag0{background:#fde5e7;background:linear-gradient(135deg,transparent .75em,#fde5e7 0) top,linear-gradient(45deg,transparent .75em,#fde5e7 0) bottom;color:#ec2f3e}html[data-theme=dark] .page-tag-item.tag0{background:#340509;background:linear-gradient(135deg,transparent .75em,#340509 0) top,linear-gradient(45deg,transparent .75em,#340509 0) bottom;color:#ba111f}.page-tag-item.tag0.clickable:hover{background:#f9bec3;background:linear-gradient(135deg,transparent .75em,#f9bec3 0) top,linear-gradient(45deg,transparent .75em,#f9bec3 0) bottom}html[data-theme=dark] .page-tag-item.tag0.clickable:hover{background:#53080e;background:linear-gradient(135deg,transparent .75em,#53080e 0) top,linear-gradient(45deg,transparent .75em,#53080e 0) bottom}.page-tag-item.tag1{background:#ffeee8;background:linear-gradient(135deg,transparent .75em,#ffeee8 0) top,linear-gradient(45deg,transparent .75em,#ffeee8 0) bottom;color:#fb7649}html[data-theme=dark] .page-tag-item.tag1{background:#441201;background:linear-gradient(135deg,transparent .75em,#441201 0) top,linear-gradient(45deg,transparent .75em,#441201 0) bottom;color:#f54205}.page-tag-item.tag1.clickable:hover{background:#fed4c6;background:linear-gradient(135deg,transparent .75em,#fed4c6 0) top,linear-gradient(45deg,transparent .75em,#fed4c6 0) bottom}html[data-theme=dark] .page-tag-item.tag1.clickable:hover{background:#6d1d02;background:linear-gradient(135deg,transparent .75em,#6d1d02 0) top,linear-gradient(45deg,transparent .75em,#6d1d02 0) bottom}.page-tag-item.tag2{background:#fef5e7;background:linear-gradient(135deg,transparent .75em,#fef5e7 0) top,linear-gradient(45deg,transparent .75em,#fef5e7 0) bottom;color:#f5b041}html[data-theme=dark] .page-tag-item.tag2{background:#3e2703;background:linear-gradient(135deg,transparent .75em,#3e2703 0) top,linear-gradient(45deg,transparent .75em,#3e2703 0) bottom;color:#e08e0b}.page-tag-item.tag2.clickable:hover{background:#fce6c4;background:linear-gradient(135deg,transparent .75em,#fce6c4 0) top,linear-gradient(45deg,transparent .75em,#fce6c4 0) bottom}html[data-theme=dark] .page-tag-item.tag2.clickable:hover{background:#633f05;background:linear-gradient(135deg,transparent .75em,#633f05 0) top,linear-gradient(45deg,transparent .75em,#633f05 0) bottom}.page-tag-item.tag3{background:#eafaf1;background:linear-gradient(135deg,transparent .75em,#eafaf1 0) top,linear-gradient(45deg,transparent .75em,#eafaf1 0) bottom;color:#55d98d}html[data-theme=dark] .page-tag-item.tag3{background:#0c331c;background:linear-gradient(135deg,transparent .75em,#0c331c 0) top,linear-gradient(45deg,transparent .75em,#0c331c 0) bottom;color:#29b866}.page-tag-item.tag3.clickable:hover{background:#caf3db;background:linear-gradient(135deg,transparent .75em,#caf3db 0) top,linear-gradient(45deg,transparent .75em,#caf3db 0) bottom}html[data-theme=dark] .page-tag-item.tag3.clickable:hover{background:#12522d;background:linear-gradient(135deg,transparent .75em,#12522d 0) top,linear-gradient(45deg,transparent .75em,#12522d 0) bottom}.page-tag-item.tag4{background:#e6f9ee;background:linear-gradient(135deg,transparent .75em,#e6f9ee 0) top,linear-gradient(45deg,transparent .75em,#e6f9ee 0) bottom;color:#36d278}html[data-theme=dark] .page-tag-item.tag4{background:#092917;background:linear-gradient(135deg,transparent .75em,#092917 0) top,linear-gradient(45deg,transparent .75em,#092917 0) bottom;color:#219552}.page-tag-item.tag4.clickable:hover{background:#c0f1d5;background:linear-gradient(135deg,transparent .75em,#c0f1d5 0) top,linear-gradient(45deg,transparent .75em,#c0f1d5 0) bottom}html[data-theme=dark] .page-tag-item.tag4.clickable:hover{background:#0f4224;background:linear-gradient(135deg,transparent .75em,#0f4224 0) top,linear-gradient(45deg,transparent .75em,#0f4224 0) bottom}.page-tag-item.tag5{background:#e1fcfc;background:linear-gradient(135deg,transparent .75em,#e1fcfc 0) top,linear-gradient(45deg,transparent .75em,#e1fcfc 0) bottom;color:#16e1e1}html[data-theme=dark] .page-tag-item.tag5{background:#042929;background:linear-gradient(135deg,transparent .75em,#042929 0) top,linear-gradient(45deg,transparent .75em,#042929 0) bottom;color:#0e9595}.page-tag-item.tag5.clickable:hover{background:#b4f8f8;background:linear-gradient(135deg,transparent .75em,#b4f8f8 0) top,linear-gradient(45deg,transparent .75em,#b4f8f8 0) bottom}html[data-theme=dark] .page-tag-item.tag5.clickable:hover{background:#064242;background:linear-gradient(135deg,transparent .75em,#064242 0) top,linear-gradient(45deg,transparent .75em,#064242 0) bottom}.page-tag-item.tag6{background:#e4f0fe;background:linear-gradient(135deg,transparent .75em,#e4f0fe 0) top,linear-gradient(45deg,transparent .75em,#e4f0fe 0) bottom;color:#2589f6}html[data-theme=dark] .page-tag-item.tag6{background:#021b36;background:linear-gradient(135deg,transparent .75em,#021b36 0) top,linear-gradient(45deg,transparent .75em,#021b36 0) bottom;color:#0862c3}.page-tag-item.tag6.clickable:hover{background:#bbdafc;background:linear-gradient(135deg,transparent .75em,#bbdafc 0) top,linear-gradient(45deg,transparent .75em,#bbdafc 0) bottom}html[data-theme=dark] .page-tag-item.tag6.clickable:hover{background:#042c57;background:linear-gradient(135deg,transparent .75em,#042c57 0) top,linear-gradient(45deg,transparent .75em,#042c57 0) bottom}.page-tag-item.tag7{background:#f7f1fd;background:linear-gradient(135deg,transparent .75em,#f7f1fd 0) top,linear-gradient(45deg,transparent .75em,#f7f1fd 0) bottom;color:#bb8ced}html[data-theme=dark] .page-tag-item.tag7{background:#2a0b4b;background:linear-gradient(135deg,transparent .75em,#2a0b4b 0) top,linear-gradient(45deg,transparent .75em,#2a0b4b 0) bottom;color:#9851e4}.page-tag-item.tag7.clickable:hover{background:#eadbfa;background:linear-gradient(135deg,transparent .75em,#eadbfa 0) top,linear-gradient(45deg,transparent .75em,#eadbfa 0) bottom}html[data-theme=dark] .page-tag-item.tag7.clickable:hover{background:#431277;background:linear-gradient(135deg,transparent .75em,#431277 0) top,linear-gradient(45deg,transparent .75em,#431277 0) bottom}.page-tag-item.tag8{background:#fdeaf5;background:linear-gradient(135deg,transparent .75em,#fdeaf5 0) top,linear-gradient(45deg,transparent .75em,#fdeaf5 0) bottom;color:#ef59ab}html[data-theme=dark] .page-tag-item.tag8{background:#400626;background:linear-gradient(135deg,transparent .75em,#400626 0) top,linear-gradient(45deg,transparent .75em,#400626 0) bottom;color:#e81689}.page-tag-item.tag8.clickable:hover{background:#facbe5;background:linear-gradient(135deg,transparent .75em,#facbe5 0) top,linear-gradient(45deg,transparent .75em,#facbe5 0) bottom}html[data-theme=dark] .page-tag-item.tag8.clickable:hover{background:#670a3d;background:linear-gradient(135deg,transparent .75em,#670a3d 0) top,linear-gradient(45deg,transparent .75em,#670a3d 0) bottom}.toc-place-holder{margin-inline:auto;padding-inline:2.5rem;position:sticky;top:calc(var(--navbar-height) + 2rem);z-index:99;max-width:var(--content-width, 740px)}@media (max-width: 959px){.toc-place-holder{padding-inline:1.5rem}}@media print{.toc-place-holder{max-width:unset}}.toc-place-holder+.theme-hope-content:not(.custom){padding-top:0}#toc{position:absolute;inset-inline-start:calc(100% + 1rem);display:none;min-width:10rem;max-width:15rem}@media (min-width: 1440px){.has-toc #toc{display:block}}@media print{#toc{display:none!important}}#toc .toc-header{margin-bottom:.75rem;margin-inline-start:.5rem;font-weight:600;font-size:.875rem}#toc .toc-wrapper{position:relative;overflow:hidden auto;max-height:75vh;margin:0 .5rem;padding-inline-start:8px;text-overflow:ellipsis;white-space:nowrap;scroll-behavior:smooth}#toc .toc-wrapper::-webkit-scrollbar-track-piece{background:transparent}#toc .toc-wrapper::-webkit-scrollbar{width:3px}#toc .toc-wrapper::-webkit-scrollbar-thumb:vertical{background:#ddd}html[data-theme=dark] #toc .toc-wrapper::-webkit-scrollbar-thumb:vertical{background:#333}#toc .toc-wrapper:before{content:" ";position:absolute;top:0;bottom:0;inset-inline-start:0;z-index:-1;width:2px;background:var(--border-color)}#toc .toc-list{position:relative;margin:0;padding:0}#toc .toc-marker{content:" ";position:absolute;top:0;inset-inline-start:-8px;z-index:2;width:2px;height:1.7rem;background:var(--theme-color);transition:top var(--vp-tt)}#toc .toc-link{position:relative;display:block;overflow:hidden;max-width:100%;color:var(--light-grey);line-height:inherit;text-overflow:ellipsis;white-space:nowrap}#toc .toc-link.level2{padding-inline-start:0px;font-size:14px}#toc .toc-link.level3{padding-inline-start:8px;font-size:13px}#toc .toc-link.level4{padding-inline-start:16px;font-size:12px}#toc .toc-link.level5{padding-inline-start:24px;font-size:11px}#toc .toc-link.level6{padding-inline-start:32px;font-size:10px}#toc .toc-item{position:relative;box-sizing:border-box;height:1.7rem;padding:0 .5rem;list-style:none;line-height:1.7rem}#toc .toc-item:hover>.toc-link{color:var(--theme-color)}#toc .toc-item.active>.toc-link{color:var(--theme-color);font-weight:700}.dropdown-wrapper{cursor:pointer}.dropdown-wrapper:not(:hover) .arrow{transform:rotate(-180deg)}.dropdown-wrapper .dropdown-title{border-width:0;background:transparent;cursor:pointer;padding:0 .25rem;color:var(--dark-grey);font-weight:500;font-size:inherit;font-family:inherit;line-height:inherit;cursor:inherit}.dropdown-wrapper .dropdown-title:hover{border-color:transparent}.dropdown-wrapper .dropdown-title .icon{margin-inline-end:.25em;font-size:1em}.dropdown-wrapper .dropdown-title .arrow{display:inline-block;vertical-align:middle;width:1em;height:1em;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;line-height:normal;transition:all .3s;font-size:1.2em}html[data-theme=dark] .dropdown-wrapper .dropdown-title .arrow{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E")}.dropdown-wrapper .dropdown-title .arrow.down{transform:rotate(180deg)}html[dir=rtl] .dropdown-wrapper .dropdown-title .arrow.down{transform:rotate(-180deg)}.dropdown-wrapper .dropdown-title .arrow.end{transform:rotate(90deg)}html[dir=rtl] .dropdown-wrapper .dropdown-title .arrow.end,.dropdown-wrapper .dropdown-title .arrow.start{transform:rotate(-90deg)}html[dir=rtl] .dropdown-wrapper .dropdown-title .arrow.start{transform:rotate(90deg)}.dropdown-wrapper ul{margin:0;padding:0;list-style-type:none}.dropdown-wrapper .nav-dropdown{position:absolute;top:100%;inset-inline-end:0;overflow-y:auto;box-sizing:border-box;min-width:6rem;max-height:calc(100vh - var(--navbar-height));margin:0;padding:.5rem .75rem;border:1px solid var(--grey14);border-radius:.5rem;background:var(--bg-color);box-shadow:2px 2px 10px var(--card-shadow);text-align:start;white-space:nowrap;opacity:0;visibility:hidden;transition:all .18s ease-out;transform:scale(.9)}.dropdown-wrapper:hover .nav-dropdown,.dropdown-wrapper.open .nav-dropdown{z-index:2;opacity:1;visibility:visible;transform:none}.dropdown-wrapper .nav-link{position:relative;display:block;margin-bottom:0;border-bottom:none;color:var(--dark-grey);font-weight:400;font-size:.875rem;line-height:1.7rem;transition:color var(--color-transition)}.dropdown-wrapper .nav-link:hover,.dropdown-wrapper .nav-link.active{color:var(--theme-color)}.dropdown-wrapper .dropdown-subtitle{margin:0;padding:.5rem .25rem 0;color:var(--light-grey);font-weight:600;font-size:.75rem;line-height:2;text-transform:uppercase;transition:color var(--color-transition)}.dropdown-wrapper .dropdown-subitem-wrapper{padding:0 0 .25rem}.dropdown-wrapper .dropdown-item{color:inherit;line-height:1.7rem}.dropdown-wrapper .dropdown-item:last-child .dropdown-subtitle{padding-top:0}.dropdown-wrapper .dropdown-item:last-child .dropdown-subitem-wrapper{padding-bottom:0}.nav-screen-dropdown-title{border-width:0;background:transparent;position:relative;display:flex;align-items:center;width:100%;padding:0;color:var(--dark-grey);font-size:inherit;font-family:inherit;text-align:start;cursor:pointer}.nav-screen-dropdown-title:hover,.nav-screen-dropdown-title.active{color:var(--text-color)}.nav-screen-dropdown-title .title{flex:1}.nav-screen-dropdown-title .arrow{display:inline-block;vertical-align:middle;width:1em;height:1em;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;line-height:normal;transition:all .3s}html[data-theme=dark] .nav-screen-dropdown-title .arrow{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E")}.nav-screen-dropdown-title .arrow.down{transform:rotate(180deg)}html[dir=rtl] .nav-screen-dropdown-title .arrow.down{transform:rotate(-180deg)}.nav-screen-dropdown-title .arrow.end{transform:rotate(90deg)}html[dir=rtl] .nav-screen-dropdown-title .arrow.end,.nav-screen-dropdown-title .arrow.start{transform:rotate(-90deg)}html[dir=rtl] .nav-screen-dropdown-title .arrow.start{transform:rotate(90deg)}.nav-screen-dropdown{overflow:hidden;margin:.5rem 0 0;padding:0;list-style:none;transition:transform .1s ease-out;transform:scaleY(1);transform-origin:top}.nav-screen-dropdown.hide{height:0;margin:0;transform:scaleY(0)}.nav-screen-dropdown .nav-link{position:relative;display:block;padding-inline-start:.5rem;font-weight:400;line-height:2}.nav-screen-dropdown .nav-link:hover,.nav-screen-dropdown .nav-link.active{color:var(--theme-color)}.nav-screen-dropdown .nav-link .icon{font-size:1em}.nav-screen-dropdown .dropdown-item{color:inherit;line-height:1.7rem}.nav-screen-dropdown .dropdown-subtitle{margin:0;padding-inline-start:.25rem;color:var(--light-grey);font-weight:600;font-size:.75rem;line-height:2;text-transform:uppercase;transition:color var(--color-transition)}.nav-screen-dropdown .dropdown-subtitle .nav-link{padding:0}.nav-screen-dropdown .dropdown-subitem-wrapper{margin:0;padding:0;list-style:none}.nav-screen-dropdown .dropdown-subitem{padding-inline-start:.5rem;font-size:.9em}.nav-screen-links{display:none;padding-bottom:.75rem}@media (max-width: 719px){.nav-screen-links{display:block}}.nav-screen-links .navbar-links-item{position:relative;display:block;padding:12px 4px 11px 0;border-bottom:1px solid var(--border-color);font-size:16px;line-height:1.5rem;transition:border-bottom-color var(--color-transition)}.nav-screen-links .nav-link{display:inline-block;width:100%;color:var(--dark-grey);font-weight:400}.nav-screen-links .nav-link:hover{color:var(--text-color)}.nav-screen-links .nav-link.active{color:var(--theme-color)}.vp-nav-screen-container{max-width:320px;margin:0 auto;padding:2rem 0 4rem}#nav-screen{position:fixed;inset:var(--navbar-height) 0 0 0;z-index:150;display:none;overflow-y:auto;padding:0 2rem;background:var(--bg-color);transition:background .5s}@media (max-width: 719px){#nav-screen{display:block}}#nav-screen.fade-enter-active,#nav-screen.fade-leave-active{transition:opacity .25s}#nav-screen.fade-enter-active .vp-nav-screen-container,#nav-screen.fade-leave-active .vp-nav-screen-container{transition:transform .25s ease}#nav-screen.fade-enter-from,#nav-screen.fade-leave-to{opacity:0}#nav-screen.fade-enter-from .vp-nav-screen-container,#nav-screen.fade-leave-to .vp-nav-screen-container{transform:translateY(-8px)}#nav-screen .icon{margin-inline-end:.25em;font-size:1em}#nav-screen img.icon{vertical-align:-.125em;height:1em}.vp-outlook-wrapper{display:flex;justify-content:space-around}.vp-nav-logo{vertical-align:top;height:var(--navbar-line-height);margin-inline-end:.8rem}.vp-nav-logo.light{display:inline-block}.vp-nav-logo.dark,html[data-theme=dark] .vp-nav-logo.light{display:none}html[data-theme=dark] .vp-nav-logo.dark{display:inline-block}.vp-site-name{position:relative;color:var(--text-color);font-size:1.25rem}@media (max-width: 719px){.vp-site-name{overflow:hidden;width:calc(100vw - 9.4rem);text-overflow:ellipsis;white-space:nowrap}}.vp-brand:hover .vp-site-name{color:var(--theme-color)}.vp-navbar .vp-nav-links{display:flex;align-items:center;font-size:.875rem}.vp-navbar .nav-item{position:relative;margin:0 .25rem;line-height:2rem}.vp-navbar .nav-item:first-child{margin-inline-start:0}.vp-navbar .nav-item:last-child{margin-inline-end:0}.vp-navbar .nav-item>.nav-link{color:var(--dark-grey)}.vp-navbar .nav-item>.nav-link:after{content:" ";position:absolute;inset:auto 50% 0;height:2px;border-radius:1px;background:var(--theme-color-light);visibility:hidden;transition:inset .2s ease-in-out}.vp-navbar .nav-item>.nav-link.active{color:var(--theme-color)}.vp-navbar .nav-item>.nav-link:hover:after,.vp-navbar .nav-item>.nav-link.active:after{inset:auto 0 0;visibility:visible}.vp-navbar{--navbar-line-height: calc( var(--navbar-height) - var(--navbar-vertical-padding) * 2 );position:fixed;inset:0 0 auto;z-index:175;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;height:var(--navbar-height);padding:var(--navbar-vertical-padding) var(--navbar-horizontal-padding);background:var(--navbar-bg-color);box-shadow:0 2px 8px var(--card-shadow);line-height:var(--navbar-line-height);white-space:nowrap;transition:transform ease-in-out .3s,background var(--color-transition),box-shadow var(--color-transition);-webkit-backdrop-filter:saturate(150%) blur(12px);backdrop-filter:saturate(150%) blur(12px)}@media print{.vp-navbar{display:none}}.hide-navbar .vp-navbar.auto-hide{transform:translateY(-100%)}.vp-navbar .nav-link{padding:0 .25rem;color:var(--dark-grey)}.vp-navbar .nav-link.active{color:var(--theme-color)}.vp-navbar .nav-link .icon{margin-inline-end:.25em;font-size:1em}.vp-navbar .nav-link img.icon{vertical-align:-.125em;height:1em}.vp-navbar.hide-icon .vp-nav-links .icon{display:none!important}.vp-navbar-start,.vp-navbar-end,.vp-navbar-center{display:flex;flex:1;align-items:center}.vp-navbar-start>*,.vp-navbar-end>*,.vp-navbar-center>*{position:relative;margin:0 .25rem!important}.vp-navbar-start>*:first-child,.vp-navbar-end>*:first-child,.vp-navbar-center>*:first-child{margin-inline-start:0!important}.vp-navbar-start>*:last-child,.vp-navbar-end>*:last-child,.vp-navbar-center>*:last-child{margin-inline-end:0!important}.vp-navbar-start{justify-content:start}.vp-navbar-center{justify-content:center}.vp-navbar-end{justify-content:end}.vp-navbar .vp-repo{margin:0!important}.vp-navbar .vp-repo-link{display:inline-block;margin:auto;padding:6px;color:var(--dark-grey);line-height:1}.vp-navbar .vp-repo-link:hover,.vp-navbar .vp-repo-link:active{color:var(--theme-color)}.vp-toggle-navbar-button{border-width:0;background:transparent;cursor:pointer;position:relative;display:none;align-items:center;justify-content:center;padding:6px}@media screen and (max-width: 719px){.vp-toggle-navbar-button{display:flex}}.vp-toggle-navbar-button>span{position:relative;overflow:hidden;width:16px;height:14px}.vp-toggle-navbar-button .vp-top,.vp-toggle-navbar-button .vp-middle,.vp-toggle-navbar-button .vp-bottom{position:absolute;width:16px;height:2px;background:var(--dark-grey);transition:top .25s,background .5s,transform .25s}.vp-toggle-navbar-button .vp-top{top:0;left:0;transform:translate(0)}.vp-toggle-navbar-button .vp-middle{top:6px;left:0;transform:translate(8px)}.vp-toggle-navbar-button .vp-bottom{top:12px;left:0;transform:translate(4px)}.vp-toggle-navbar-button:hover .vp-top{top:0;left:0;transform:translate(4px)}.vp-toggle-navbar-button:hover .vp-middle{top:6;left:0;transform:translate(0)}.vp-toggle-navbar-button:hover .vp-bottom{top:12px;left:0;transform:translate(8px)}.vp-toggle-navbar-button.is-active .vp-top{top:6px;transform:translate(0) rotate(225deg)}.vp-toggle-navbar-button.is-active .vp-middle{top:6px;transform:translate(16px)}.vp-toggle-navbar-button.is-active .vp-bottom{top:6px;transform:translate(0) rotate(135deg)}.vp-toggle-navbar-button.is-active:hover .vp-top,.vp-toggle-navbar-button.is-active:hover .vp-middle,.vp-toggle-navbar-button.is-active:hover .vp-bottom{background:var(--theme-color);transition:top .25s,background .25s,transform .25s}.vp-toggle-sidebar-button{border-width:0;background:transparent;cursor:pointer;display:none;vertical-align:middle;box-sizing:content-box;width:1rem;height:1rem;padding:.5rem;font:unset;transition:transform .2s ease-in-out}@media screen and (max-width: 719px){.vp-toggle-sidebar-button{display:block;padding-inline-end:var(--navbar-mobile-horizontal-padding)}}.vp-toggle-sidebar-button:before,.vp-toggle-sidebar-button:after,.vp-toggle-sidebar-button .icon{display:block;width:100%;height:2px;border-radius:.05em;background:var(--dark-grey);transition:transform .2s ease-in-out}.vp-toggle-sidebar-button:before{content:" ";margin-top:.125em}.sidebar-open .vp-toggle-sidebar-button:before{transform:translateY(.34rem) rotate(135deg)}.vp-toggle-sidebar-button:after{content:" ";margin-bottom:.125em}.sidebar-open .vp-toggle-sidebar-button:after{transform:translateY(-.34rem) rotate(-135deg)}.vp-toggle-sidebar-button .icon{margin:.2em 0}.sidebar-open .vp-toggle-sidebar-button .icon{transform:scale(0)}.appearance-title{display:block;margin:0;padding:0 .25rem;color:var(--light-grey);font-weight:600;font-size:.75rem;line-height:2;transition:color var(--color-transition)}#appearance-switch{border-width:0;background:transparent;vertical-align:middle;padding:6px;color:var(--dark-grey);cursor:pointer;transition:color var(--color-transition)}#appearance-switch:hover{color:var(--theme-color)}#appearance-switch .icon{width:1.25rem;height:1.25rem}.outlook-button{border-width:0;background:transparent;cursor:pointer;position:relative;padding:.375rem;color:var(--dark-grey)}.outlook-button .icon{vertical-align:middle;width:1.25rem;height:1.25rem}.outlook-dropdown{position:absolute;top:100%;inset-inline-end:0;overflow-y:auto;box-sizing:border-box;min-width:100px;margin:0;padding:.5rem .75rem;border:1px solid var(--grey14);border-radius:.25rem;background:var(--bg-color);box-shadow:2px 2px 10px var(--card-shadow);text-align:start;white-space:nowrap;opacity:0;visibility:hidden;transition:all .18s ease-out;transform:scale(.8)}.outlook-dropdown>*:not(:last-child){padding-bottom:.5rem;border-bottom:1px solid var(--grey14)}.outlook-button:hover .outlook-dropdown,.outlook-button.open .outlook-dropdown{z-index:2;opacity:1;visibility:visible;transform:scale(1)}.theme-color-title{display:block;margin:0;padding:0 .25rem;color:var(--light-grey);font-weight:600;font-size:.75rem;line-height:2;transition:color var(--color-transition)}#theme-color-picker{display:flex;margin:0;padding:0;list-style-type:none;font-size:14px}#theme-color-picker li span{display:inline-block;vertical-align:middle;width:15px;height:15px;margin:0 2px;border-radius:2px}#theme-color-picker li span.theme-color,#theme-color-picker li span.theme-color html[data-theme=dark]{background:#2980b9}@media print{.full-screen-wrapper{display:none}}.full-screen-title{display:block;margin:0;padding:0 .25rem;color:var(--light-grey);font-weight:600;font-size:.75rem;line-height:2;transition:color var(--color-transition)}.full-screen,.cancel-full-screen{border-width:0;background:transparent;vertical-align:middle;padding:.375rem;color:var(--dark-grey);cursor:pointer}.full-screen:hover,.cancel-full-screen:hover{color:var(--theme-color)}.full-screen .icon,.cancel-full-screen .icon{width:1.25rem;height:1.25rem}.enter-fullscreen-icon:hover,.cancel-fullscreen-icon{color:var(--theme-color)}.cancel-fullscreen-icon:hover{color:var(--dark-grey)}.vp-sidebar-heading{display:flex;align-items:center;overflow:hidden;box-sizing:border-box;width:calc(100% - 1rem);margin:0;margin-inline:.5rem;padding:.25rem .5rem;border-width:0;border-radius:.375rem;background:transparent;color:var(--text-color);font-size:1.1em;line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:color .15s ease;transform:rotate(0)}.vp-sidebar-heading.open{color:inherit}.vp-sidebar-heading.clickable:hover{background:var(--bg-color-secondary)}.vp-sidebar-heading.clickable.exact{border-inline-start-color:var(--theme-color);color:var(--theme-color)}.vp-sidebar-heading.clickable.exact a{color:inherit}.vp-sidebar-heading .vp-sidebar-title{flex:1}.vp-sidebar-heading .vp-arrow{display:inline-block;vertical-align:middle;width:1em;height:1em;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");background-position:center;background-repeat:no-repeat;line-height:normal;transition:all .3s;font-size:1.5em}html[data-theme=dark] .vp-sidebar-heading .vp-arrow{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E")}.vp-sidebar-heading .vp-arrow.down{transform:rotate(180deg)}html[dir=rtl] .vp-sidebar-heading .vp-arrow.down{transform:rotate(-180deg)}.vp-sidebar-heading .vp-arrow.end{transform:rotate(90deg)}html[dir=rtl] .vp-sidebar-heading .vp-arrow.end,.vp-sidebar-heading .vp-arrow.start{transform:rotate(-90deg)}html[dir=rtl] .vp-sidebar-heading .vp-arrow.start{transform:rotate(90deg)}button.vp-sidebar-heading{outline:none;font-weight:inherit;font-family:inherit;line-height:inherit;text-align:start;cursor:pointer}.vp-sidebar-link{display:inline-block;box-sizing:border-box;width:calc(100% - 1rem);margin-inline:.5rem;padding:.25rem .5rem;border-radius:.375rem;color:var(--text-color);font-weight:400;font-size:1em;line-height:1.5}.vp-sidebar-link:hover{background:var(--bg-color-secondary)}.vp-sidebar-link.active{background:var(--theme-color-mask);color:var(--theme-color);font-weight:500}.vp-sidebar-link.active .icon{color:var(--theme-color)}.vp-sidebar-sub-headers .vp-sidebar-link{padding-top:.25rem;padding-bottom:.25rem;border-inline-start:none}.vp-sidebar-sub-headers .vp-sidebar-link.active{background:transparent;font-weight:500}.vp-sidebar-group:not(.collapsible) .vp-sidebar-heading:not(.clickable){color:inherit;cursor:auto}.vp-sidebar-group .vp-sidebar-group{padding-inline-start:.75rem}.vp-sidebar-group .vp-sidebar-group .vp-sidebar-heading{font-size:1em}.vp-sidebar-group .vp-sidebar-link{padding-inline-start:1.25rem}.vp-sidebar-links,.vp-sidebar-links ul{margin:0;padding:0}.vp-sidebar-links ul.vp-sidebar-sub-headers{padding-inline-start:.75rem;font-size:.95em}@media (min-width: 1440px){.has-toc .vp-sidebar-links ul.vp-sidebar-sub-headers{display:none}}.vp-sidebar-links li{list-style-type:none}.vp-sidebar>.vp-sidebar-links{padding:1.5rem 0}@media (max-width: 719px){.vp-sidebar>.vp-sidebar-links{padding:1rem 0}}.vp-sidebar>.vp-sidebar-links>li>.vp-sidebar-link{font-size:1.1em}.vp-sidebar>.vp-sidebar-links>li:not(:first-child){margin-top:.5rem}.vp-sidebar{position:fixed;top:0;bottom:0;inset-inline-start:0;z-index:1;overflow-y:auto;width:var(--sidebar-width);margin:0;padding-inline-start:calc(var(--sidebar-space) - var(--sidebar-width));background:var(--sidebar-bg-color);box-shadow:2px 0 8px var(--card-shadow);font-size:.94rem;transition:background var(--color-transition),box-shadow var(--color-transition),padding var(--transform-transition),transform var(--transform-transition);-webkit-backdrop-filter:saturate(150%) blur(12px);backdrop-filter:saturate(150%) blur(12px);scrollbar-color:var(--theme-color) var(--border-color);scrollbar-width:thin}@media (max-width: 959px){.vp-sidebar{font-size:.86em}}@media (max-width: 719px){.vp-sidebar{z-index:125;box-shadow:none;transform:translate(-100%)}html[dir=rtl] .vp-sidebar{transform:translate(100%)}}@media (min-width: 1440px){.vp-sidebar{padding-bottom:3rem;box-shadow:none;font-size:1rem}}@media print{.vp-sidebar{display:none}}.vp-sidebar a{display:inline-block;color:var(--text-color);font-weight:400}.vp-sidebar .icon{margin-inline-end:.25em;font-size:1em}.vp-sidebar img.icon{vertical-align:-.125em;height:1em}.vp-sidebar.hide-icon .icon{display:none!important}.vp-sidebar-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9;background:#00000026}.vp-sidebar-mask.fade-enter-active,.vp-sidebar-mask.fade-leave-active{transition:opacity .25s}.vp-sidebar-mask.fade-enter-from,.vp-sidebar-mask.fade-leave-to{opacity:0}@media (min-width: 1440px){body{font-size:16px}}:root{--font-family: gitbook-content-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-family-heading: gitbook-content-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}html[data-theme=dark]{--text-color: #FFFFFF}.giscus-wrapper{max-width:var(--content-width, 740px);margin:0 auto;padding:2rem 2.5rem}@media (max-width: 959px){.giscus-wrapper{padding:1.5rem}}@media (max-width: 419px){.giscus-wrapper{padding:1rem 1.5rem}}@media print{.giscus-wrapper{max-width:unset}}@media print{.giscus-wrapper{display:none!important}}.giscus-wrapper.input-top .giscus{margin-bottom:-3rem} diff --git a/assets/svjm7s-bmJG6WtQ.png b/assets/svjm7s-bmJG6WtQ.png new file mode 100644 index 00000000..57494689 Binary files /dev/null and b/assets/svjm7s-bmJG6WtQ.png differ diff --git a/assets/tekton.html-7q40Qc0_.js b/assets/tekton.html-7q40Qc0_.js new file mode 100644 index 00000000..4469cff7 --- /dev/null +++ b/assets/tekton.html-7q40Qc0_.js @@ -0,0 +1 @@ +const t=JSON.parse('{"key":"v-1a2ca7a7","path":"/devops/tekton.html","title":"tekton","lang":"zh-CN","frontmatter":{"description":"tekton","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/devops/tekton.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"tekton"}],["meta",{"property":"og:description","content":"tekton"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"tekton\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":0,"words":1},"filePathRelative":"devops/tekton.md","localizedDate":"2024年1月24日","excerpt":"

tekton

\\n","autoDesc":true}');export{t as data}; diff --git a/assets/tekton.html-dabteeVs.js b/assets/tekton.html-dabteeVs.js new file mode 100644 index 00000000..b533cd4e --- /dev/null +++ b/assets/tekton.html-dabteeVs.js @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o,c as a,a as e,d as n}from"./app-hbwtiwmf.js";const r={},c=e("h1",{id:"tekton",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#tekton","aria-hidden":"true"},"#"),n(" tekton")],-1),s=[c];function _(d,i){return o(),a("div",null,s)}const f=t(r,[["render",_],["__file","tekton.html.vue"]]);export{f as default}; diff --git a/assets/tesla.html-2Acqdst4.js b/assets/tesla.html-2Acqdst4.js new file mode 100644 index 00000000..a2da6231 --- /dev/null +++ b/assets/tesla.html-2Acqdst4.js @@ -0,0 +1,30 @@ +import{_ as i}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as p,o,c as r,a as e,d as a,b as t,e as n}from"./app-hbwtiwmf.js";const l="/assets/3hnb7w-g33gFTSI.png",c="/assets/zdto5j-gqirjUeR.png",d="/assets/mfthul-8EWpI2y9.png",u="/assets/y6s6ea-2pjtvQi0.png",h="/assets/5fxmcv-O2AtIfM7.png",m="/assets/kpdjbc-5yOT32pq.png",v={},b=n('

Tesla api

一、特斯拉应用申请

1.1 创建 Tesla 账户

如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。

正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator.

image-20231210142130054image-20231210142415598

注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。

1.2 提交访问请求

点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。

这一步很坑,多次尝试之后都无果,原因也不知道是为啥,只能自己去看返回报文琢磨,太难受了,下面是自己踩的坑

(1)Invalid domain

image-20231210144504486',13),k={href:"https://baidu.xn--com-s63e",target:"_blank",rel:"noopener noreferrer"},_=n('

(2)Unable to Onboard

image-20231210142930976

应用无法上架,可能原因为邮箱不对,用了之前消费者账号(即自己的车辆账号),建议换别的邮箱试试。

(3) Rejected

image-20231210143156308

这一步尝试了很多次,具体原因为国内还无法正常使用tesla api,只能切换至美国服务器申请下(截止2023-11-15),后续留意官网通知。

1.3 访问应用程序凭据

一旦获得批准,将为您的应用程序生成可在登录后访问的客户端 ID 和客户端密钥。使用这些凭据,通过 OAuth 2.0 身份验证获取用户访问令牌。访问令牌可用于对提供私人用户账户信息或代表其他账户执行操作的请求进行身份验证。

申请好就可以在自己的账号下看到自己的应用了,

image-20231210144244888

1.4 开始 API 集成

按照 API 文档和设置说明将您的应用程序与 Tesla 车队 API 集成。您需要生成并注册公钥,请求用户授权并按照规格要求拨打电话。完成后您将能够与 API 进行交互,并开始围绕 Tesla 设备构建集成。

二、开发之前的准备

由于特斯拉刚推出,并且国内进展缓慢,很多都申请不下来,下面内容均以北美区域进行调用。

2.1 认识token

app与特斯拉交互的共有两个令牌(token)方式,在调用api的时候,特别需要注意使用的是哪种token,下面是两种token的说明:

(1)合作伙伴身份验证令牌:这个就是你申请的app的令牌

(2)客户生成第三方令牌:这个是消费者在你这个app下授权之后的令牌。

',18),g={href:"https://fleet-api.prd.cn.vn.cloud.tesla.cn/",target:"_blank",rel:"noopener noreferrer"},f=n(`

2.2 获取第三方应用token

这一步官网列的很详细,就不在详述了。

CLIENT_ID=<command to obtain a client_id>
+CLIENT_SECRET=<secure command to obtain a client_secret>
+AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com"
+# Partner authentication token request
+curl --request POST \\
+  --header 'Content-Type: application/x-www-form-urlencoded' \\
+  --data-urlencode 'grant_type=client_credentials' \\
+  --data-urlencode "client_id=$CLIENT_ID" \\
+  --data-urlencode "client_secret=$CLIENT_SECRET" \\
+  --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \\
+  --data-urlencode "audience=$AUDIENCE" \\
+  'https://auth.tesla.com/oauth2/v3/token'
+
+

2.3 验证域名归属

2.1.1 Register

完成注册合作方账号之后才可以访问API. 每个developer.tesla.cn上的应用程序都必须完成此步骤。官网挂了一个github的代码,看了半天,以为要搞很多东西,实际上只需要几步就可以了。

cd vehicle-command/cmd/tesla-keygen
+go build .
+./tesla-keygen -f -keyring-debug -key-file=private create > public_key.pem
+

这里只是生成了公钥,需要把公钥挂载到域名之下,我们用的是nginx,所以只要指向pem文件就可以了,注意下nginx是否可以访问到改文件,如果不行,把nginx的user改为root。

    location ~ ^/.well-known {
+           default_type text/html;
+           alias /root/vehicle-command/cmd/tesla-keygen/public_key.pem;
+    }
+

随后,便是向tesla注册你的域名,域名必须和你申请的时候填的一样。

curl --header 'Content-Type: application/json' \\
+  --header "Authorization: Bearer $TESLA_API_TOKEN" \\
+  --data '{"domain":"string"}' \\
+  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts' 
+
+

2.1.2 public_key

最后,验证一下是否真的注册成功(GET /api/1/partner_accounts/public_key)

curl --header 'Content-Type: application/json' \\
+  --header "Authorization: Bearer $TESLA_API_TOKEN" \\
+  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key' 
+

得到下面内容就代表成功了

{"response":{"public_key":"xxxx"}}
+

至此,我们的开发准备就完成了,接下来就是正常的开发与用户交互的api。

`,17);function x(y,q){const s=p("ExternalLinkIcon");return o(),r("div",null,[b,e("p",null,[a("无效的域名,这里我用的域名是腾讯云个人服务器的域名,证书是腾讯云免费一年的证书,印象中第一申请的时候还是能过的,第二次的时候就不行了,可能被识别到免费的ssl证书不符合规范,还是需要由合法机构的颁发证书才行。所以,为了金快速申请通过,先填个"),e("a",k,[a("https://baidu.com吧"),t(s)]),a("。当然,后续需要彻底解决自己域名证书的问题,我改为使用阿里云的ssl证书,3个月到期的那种。")]),_,e("p",null,[a("此外,还需要注意下,中国大陆地区对应的api地址是 "),e("a",g,[a("https://fleet-api.prd.cn.vn.cloud.tesla.cn"),t(s)]),a(",不要调到别的地址去了。")]),f])}const E=i(v,[["render",x],["__file","tesla.html.vue"]]);export{E as default}; diff --git a/assets/tesla.html-ndFmDawG.js b/assets/tesla.html-ndFmDawG.js new file mode 100644 index 00000000..ce531c0b --- /dev/null +++ b/assets/tesla.html-ndFmDawG.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-3c114a75","path":"/others/tesla.html","title":"Tesla api","lang":"zh-CN","frontmatter":{"description":"Tesla api 一、特斯拉应用申请 1.1 创建 Tesla 账户 如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。 正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator. 注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。 1.2 提交访问请求 点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/others/tesla.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"Tesla api"}],["meta",{"property":"og:description","content":"Tesla api 一、特斯拉应用申请 1.1 创建 Tesla 账户 如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。 正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator. 注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。 1.2 提交访问请求 点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T12:53:13.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T12:53:13.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"Tesla api\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T12:53:13.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、特斯拉应用申请","slug":"一、特斯拉应用申请","link":"#一、特斯拉应用申请","children":[{"level":3,"title":"1.1 创建 Tesla 账户","slug":"_1-1-创建-tesla-账户","link":"#_1-1-创建-tesla-账户","children":[]},{"level":3,"title":"1.2 提交访问请求","slug":"_1-2-提交访问请求","link":"#_1-2-提交访问请求","children":[]},{"level":3,"title":"1.3 访问应用程序凭据","slug":"_1-3-访问应用程序凭据","link":"#_1-3-访问应用程序凭据","children":[]},{"level":3,"title":"1.4 开始 API 集成","slug":"_1-4-开始-api-集成","link":"#_1-4-开始-api-集成","children":[]},{"level":3,"title":"2.1 认识token","slug":"_2-1-认识token","link":"#_2-1-认识token","children":[]},{"level":3,"title":"2.2 获取第三方应用token","slug":"_2-2-获取第三方应用token","link":"#_2-2-获取第三方应用token","children":[]},{"level":3,"title":"2.3 验证域名归属","slug":"_2-3-验证域名归属","link":"#_2-3-验证域名归属","children":[]}]}],"git":{"createdTime":1706186538000,"updatedTime":1706187193000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":4.46,"words":1339},"filePathRelative":"others/tesla.md","localizedDate":"2024年1月25日","excerpt":"

Tesla api

\\n

一、特斯拉应用申请

\\n

1.1 创建 Tesla 账户

\\n

如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。

\\n

正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator.

\\n\\n\\n

注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。

\\n

1.2 提交访问请求

\\n

点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。

","autoDesc":true}');export{e as data}; diff --git a/assets/tiktok2023.html-T4HWHpaT.js b/assets/tiktok2023.html-T4HWHpaT.js new file mode 100644 index 00000000..4d953f33 --- /dev/null +++ b/assets/tiktok2023.html-T4HWHpaT.js @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as r,c as e,e as c}from"./app-hbwtiwmf.js";const o={},s=c("

tt一面:
1.全程项目
2.lc3,最长无重复子串,滑动窗口解决

tt二面:
全程基础,一直追问
1.java内存模型介绍一下
2.volatile原理
3.内存屏障,使用场景?(我提了在gc中有使用)
4.gc中具体是怎么使用内存屏障的,详细介绍
5.cms和g1介绍一下,g1能取代cms吗?g1和cms各自的使用场景是什么
6.线程内存分配方式,tlab相关
7.happens-before介绍一下
8.总线风暴是什么,怎么解决
9.网络相关,time_wait,close_wait产生原因,带来的影响,怎么解决
10.算法题,给你一个数字n,求用这个n的各位上的数字组合出最大的小于n的数字m,注意边界case,如2222
11.场景题,设计一个微信朋友圈,功能包含feed流拉取,评论,转发,点赞等操作

tt三面:
大部分聊项目,基础随便问了问
1.分布式事务,两阶段三阶段流程,区别
2.mysql主从,同步复制,半同步复制,异步复制
3.算法题,k个一组翻转链表,类似lc25,区别是最后一组不足k个也要翻转
4.场景题,设计一个评论系统,包含发布评论,回复评论,评论点赞等功能,用户过亿,qps百万

",3),b=[s];function a(_,n){return r(),e("div",null,b)}const m=t(o,[["render",a],["__file","tiktok2023.html.vue"]]);export{m as default}; diff --git a/assets/tiktok2023.html-VVmqvR2f.js b/assets/tiktok2023.html-VVmqvR2f.js new file mode 100644 index 00000000..f6d49b93 --- /dev/null +++ b/assets/tiktok2023.html-VVmqvR2f.js @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-091223ce","path":"/interview/tiktok2023.html","title":"","lang":"zh-CN","frontmatter":{"description":"tt一面: 1.全程项目 2.lc3,最长无重复子串,滑动窗口解决 tt二面: 全程基础,一直追问 1.java内存模型介绍一下 2.volatile原理 3.内存屏障,使用场景?(我提了在gc中有使用) 4.gc中具体是怎么使用内存屏障的,详细介绍 5.cms和g1介绍一下,g1能取代cms吗?g1和cms各自的使用场景是什么 6.线程内存分配方式,tlab相关 7.happens-before介绍一下 8.总线风暴是什么,怎么解决 9.网络相关,time_wait,close_wait产生原因,带来的影响,怎么解决 10.算法题,给你一个数字n,求用这个n的各位上的数字组合出最大的小于n的数字m,注意边界case,如2222 11.场景题,设计一个微信朋友圈,功能包含feed流拉取,评论,转发,点赞等操作","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/interview/tiktok2023.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:description","content":"tt一面: 1.全程项目 2.lc3,最长无重复子串,滑动窗口解决 tt二面: 全程基础,一直追问 1.java内存模型介绍一下 2.volatile原理 3.内存屏障,使用场景?(我提了在gc中有使用) 4.gc中具体是怎么使用内存屏障的,详细介绍 5.cms和g1介绍一下,g1能取代cms吗?g1和cms各自的使用场景是什么 6.线程内存分配方式,tlab相关 7.happens-before介绍一下 8.总线风暴是什么,怎么解决 9.网络相关,time_wait,close_wait产生原因,带来的影响,怎么解决 10.算法题,给你一个数字n,求用这个n的各位上的数字组合出最大的小于n的数字m,注意边界case,如2222 11.场景题,设计一个微信朋友圈,功能包含feed流拉取,评论,转发,点赞等操作"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T03:25:58.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T03:25:58.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T03:25:58.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706066758000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":1}]},"readingTime":{"minutes":1.15,"words":344},"filePathRelative":"interview/tiktok2023.md","localizedDate":"2024年1月24日","excerpt":"

tt一面:
\\n1.全程项目
\\n2.lc3,最长无重复子串,滑动窗口解决

\\n

tt二面:
\\n全程基础,一直追问
\\n1.java内存模型介绍一下
\\n2.volatile原理
\\n3.内存屏障,使用场景?(我提了在gc中有使用)
\\n4.gc中具体是怎么使用内存屏障的,详细介绍
\\n5.cms和g1介绍一下,g1能取代cms吗?g1和cms各自的使用场景是什么
\\n6.线程内存分配方式,tlab相关
\\n7.happens-before介绍一下
\\n8.总线风暴是什么,怎么解决
\\n9.网络相关,time_wait,close_wait产生原因,带来的影响,怎么解决
\\n10.算法题,给你一个数字n,求用这个n的各位上的数字组合出最大的小于n的数字m,注意边界case,如2222
\\n11.场景题,设计一个微信朋友圈,功能包含feed流拉取,评论,转发,点赞等操作

","autoDesc":true}');export{e as data}; diff --git a/assets/vfh7kn-qq6FI6AK.png b/assets/vfh7kn-qq6FI6AK.png new file mode 100644 index 00000000..d4d48b82 Binary files /dev/null and b/assets/vfh7kn-qq6FI6AK.png differ diff --git a/assets/wfekdb-J8GFOYNE.png b/assets/wfekdb-J8GFOYNE.png new file mode 100644 index 00000000..10c18705 Binary files /dev/null and b/assets/wfekdb-J8GFOYNE.png differ diff --git a/assets/y6s6ea-2pjtvQi0.png b/assets/y6s6ea-2pjtvQi0.png new file mode 100644 index 00000000..1c1cb96f Binary files /dev/null and b/assets/y6s6ea-2pjtvQi0.png differ diff --git a/assets/ykhrvs-Zpp9tS7m.png b/assets/ykhrvs-Zpp9tS7m.png new file mode 100644 index 00000000..37978b19 Binary files /dev/null and b/assets/ykhrvs-Zpp9tS7m.png differ diff --git a/assets/zdto5j-gqirjUeR.png b/assets/zdto5j-gqirjUeR.png new file mode 100644 index 00000000..3112bebc Binary files /dev/null and b/assets/zdto5j-gqirjUeR.png differ diff --git "a/assets/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html-2uDM3lKq.js" "b/assets/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html-2uDM3lKq.js" new file mode 100644 index 00000000..27cf0922 --- /dev/null +++ "b/assets/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html-2uDM3lKq.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-3f2a15ee","path":"/database/elasticsearch/%E3%80%90elasticsearch%E3%80%91%E6%90%9C%E7%B4%A2%E8%BF%87%E7%A8%8B%E8%AF%A6%E8%A7%A3.html","title":"【elasticsearch】搜索过程详解","lang":"zh-CN","frontmatter":{"description":"【elasticsearch】搜索过程详解 本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。 SearchType QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。 DFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/elasticsearch/%E3%80%90elasticsearch%E3%80%91%E6%90%9C%E7%B4%A2%E8%BF%87%E7%A8%8B%E8%AF%A6%E8%A7%A3.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"【elasticsearch】搜索过程详解"}],["meta",{"property":"og:description","content":"【elasticsearch】搜索过程详解 本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。 SearchType QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。 DFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:image","content":"http://www.wenzhihuai.com/"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T13:13:41.000Z"}],["meta",{"name":"twitter:card","content":"summary_large_image"}],["meta",{"name":"twitter:image:alt","content":"【elasticsearch】搜索过程详解"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T13:13:41.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"【elasticsearch】搜索过程详解\\",\\"image\\":[\\"http://www.wenzhihuai.com/\\"],\\"dateModified\\":\\"2024-01-25T13:13:41.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":3,"title":"SearchType","slug":"searchtype","link":"#searchtype","children":[]},{"level":2,"title":"搜索入口:","slug":"搜索入口","link":"#搜索入口","children":[]},{"level":2,"title":"3.1 query阶段","slug":"_3-1-query阶段","link":"#_3-1-query阶段","children":[]},{"level":2,"title":"3.2 Fetch阶段","slug":"_3-2-fetch阶段","link":"#_3-2-fetch阶段","children":[{"level":3,"title":"3.2.1 FetchSearchPhase(对应上面的1)","slug":"_3-2-1-fetchsearchphase-对应上面的1","link":"#_3-2-1-fetchsearchphase-对应上面的1","children":[]},{"level":3,"title":"3.2.2 ExpandSearchPhase(对应上图的2)","slug":"_3-2-2-expandsearchphase-对应上图的2","link":"#_3-2-2-expandsearchphase-对应上图的2","children":[]}]},{"level":2,"title":"4.1 执行query、fetch流程","slug":"_4-1-执行query、fetch流程","link":"#_4-1-执行query、fetch流程","children":[]}],"git":{"createdTime":1706183164000,"updatedTime":1706188421000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":8.83,"words":2650},"filePathRelative":"database/elasticsearch/【elasticsearch】搜索过程详解.md","localizedDate":"2024年1月25日","excerpt":"

【elasticsearch】搜索过程详解

\\n

本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。

\\n

SearchType

\\n

QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。
\\nDFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。

","autoDesc":true}');export{e as data}; diff --git "a/assets/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html-qP1HLlwB.js" "b/assets/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html-qP1HLlwB.js" new file mode 100644 index 00000000..006d89bc --- /dev/null +++ "b/assets/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html-qP1HLlwB.js" @@ -0,0 +1,300 @@ +import{_ as p}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as c,o,c as i,a as n,d as s,b as t,e}from"./app-hbwtiwmf.js";const u="/assets/1240-Bv6EG5xm.png",l="/assets/1240-20240125205906732-3JnHoeWt.png",r="/assets/1240-20240125210335027-McP_Ljsy.png",k="/assets/1240-20240125210338196-a9YM81Rs.png",d="/assets/1240-20240125205916232-uk0gBVIt.png",v="/assets/1240-20240125205923525--CBzDE9M.png",h="/assets/1240-20240125205928956-l0-uUrdD.png",m="/assets/1240-20240125205939879-Y6BQ23IR.png",b="/assets/1240-20240125205944929-A0LlTV85.png",g="/assets/1240-20240125205952628-03TY1GXm.png",f="/assets/1240-20240125205957133-hc_ibD3B.png",y="/assets/1240-20240125210045403-vE_MYP5P.png",q={},x=e(`

【elasticsearch】搜索过程详解

本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。

SearchType

QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。
DFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。

为了能够深刻了解es的搜索过程,首先创建3个索引,每个索引指定一天的一条记录。

POST aaaa-16/_doc
+{
+  "@timestamp": "2022-02-16T16:21:15.000Z",
+  "word":"16"
+}
+
+
+POST aaaa-17/_doc
+{
+  "@timestamp": "2022-02-17T16:21:15.000Z",
+  "word":"17"
+}
+
+POST aaaa-18/_doc
+{
+  "@timestamp": "2022-02-18T16:21:15.000Z",
+  "word":"18"
+}
+

即可在kibana上看到3条数据

image-20220219195141327
image-20220219195141327

此时,假设我们用一个索引+星号来搜索,es内部的搜索是怎么样的呢?

GET aaaa*/_search
+{
+  "query": {
+    "range": {
+      "@timestamp": {
+        "gte": "2022-02-18T10:21:15.000Z",
+        "lte": "2022-02-18T17:21:15.000Z"
+      }
+    }
+  }
+}
+

正好命中一条记录返回。

{
+  "took" : 2,
+  "timed_out" : false,
+  "_shards" : {
+    "total" : 3,
+    "successful" : 3,
+    "skipped" : 0,
+    "failed" : 0
+  },
+  "hits" : {
+    "total" : {
+      "value" : 1,
+      "relation" : "eq"
+    },
+    "max_score" : 1.0,
+    "hits" : [
+      {
+        "_index" : "aaaa-18",
+        "_id" : "0zB2O38BoMIMP8QzHgdq",
+        "_score" : 1.0,
+        "_source" : {
+          "@timestamp" : "2022-02-18T16:21:15.000Z",
+          "word" : "18"
+        }
+      }
+    ]
+  }
+}
+
+

一、es的分布式搜索过程

`,13),w={href:"https://weread.qq.com/web/reader/f9c32dc07184876ef9cdeb6k7f33291023d7f39f8317e0b",target:"_blank",rel:"noopener noreferrer"},S=e('
2
2

搜索入口:

整个http请求的入口,主要使用的是Netty4HttpRequestHandler。

@ChannelHandler.Sharable
+class Netty4HttpRequestHandler extends SimpleChannelInboundHandler<HttpPipelinedRequest> {
+    @Override
+    protected void channelRead0(ChannelHandlerContext ctx, HttpPipelinedRequest httpRequest) {
+        final Netty4HttpChannel channel = ctx.channel().attr(Netty4HttpServerTransport.HTTP_CHANNEL_KEY).get();
+        boolean success = false;
+        try {
+            serverTransport.incomingRequest(httpRequest, channel);
+            success = true;
+        } finally {
+            if (success == false) {
+                httpRequest.release();
+            }
+        }
+    }
+}
+

二、初步调用流程

调用链路过程:Netty4HttpRequestHandler.channelRead0->AbstractHttpServerTransport.incomingRequest->AbstractHttpServerTransport.handleIncomingRequest->AbstractHttpServerTransport.dispatchRequest->RestController.dispatchRequest(实现了HttpServerTransport.Dispatcher)->SecurityRestFilter.handleRequest->BaseRestHandler.handleRequest->action.accept(channel)->RestCancellableNodeClient.doExecute->NodeClient.executeLocally->RequestFilterChain.proceed->TransportAction.proceed->TransportSearchAction.doExecute->TransportSearchAction.executeRequest(判断是本地执行还是远程执行)->TransportSearchAction.searchAsyncAction

协调节点的主要功能是接收请求,解析并构建目的的shard列表,然后异步发送到数据节点进行请求查询。具体就不细讲了,可按着debug的来慢慢调试。

特别注意下RestCancellableNodeClient.doExecute,从executeLocally执行所有的查询过程,并注册监听listener.onResponse(response),然后响应。

public <Request extends ActionRequest, Response extends ActionResponse> void doExecute(...) {
+  ...
+    TaskHolder taskHolder = new TaskHolder();
+    Task task = client.executeLocally(action, request, new ActionListener<>() {
+        @Override
+        public void onResponse(Response response) {
+            try {
+                closeListener.unregisterTask(taskHolder);
+            } finally {
+                listener.onResponse(response);
+            }
+        }
+    });
+  ...
+}
+

其次要注意的是:TransportSearchAction.searchAsyncAction才开始真正的搜索过程

private SearchPhase searchAsyncAction(...) {
+  ...
+    final QueryPhaseResultConsumer queryResultConsumer = searchPhaseController.newSearchPhaseResults();
+  AbstractSearchAsyncAction<? extends SearchPhaseResult> searchAsyncAction = switch (searchRequest.searchType()) {
+    case DFS_QUERY_THEN_FETCH -> new SearchDfsQueryThenFetchAsyncAction(...);
+    case QUERY_THEN_FETCH -> new SearchQueryThenFetchAsyncAction(...);
+  };
+  return searchAsyncAction;
+  ...
+}
+

之后就是执行AbstractSearchAsyncAction.start,启动AbstractSearchAsyncAction.executePhase的查询动作。

此处的SearchPhase实现类为SearchQueryThenFetchAsyncAction
+private void executePhase(SearchPhase phase) {
+    try {
+        phase.run();
+    } catch (Exception e) {
+        if (logger.isDebugEnabled()) {
+            logger.debug(new ParameterizedMessage("Failed to execute [{}] while moving to [{}] phase", request, phase.getName()), e);
+        }
+        onPhaseFailure(phase, "", e);
+    }
+}
+

三、协调节点

两阶段相应的实现位置:查询(Query)阶段—search.SearchQueryThenFetchAsyncAction;取回(Fetch)阶段—search.FetchSearchPhase。它们都继承自SearchPhase,如下图所示。

23
23

3.1 query阶段

',17),R={href:"https://www.elastic.co/Zephery/en/elasticsearch/Zephery/current/_query_phase.html",target:"_blank",rel:"noopener noreferrer"},_=e('
12
12

(1)客户端发送一个search请求到node3,node3创建一个大小为from,to的优先级队列。
(2)node3转发转发search请求至索引的主分片或者副本,每个分片执行查询请求,并且将结果放到一个排序之后的from、to大小的优先级队列。
(3)每个分片把文档id和排序之后的值返回给协调节点node3,node3把结果合并然后创建一个全局排序之后的结果。

在RestSearchAction#prepareRequest方法中将请求体解析为SearchRequest 数据结构: 
+public RestChannelConsumer prepareRequest(.. .) {
+    SearchRequest searchRequest = new SearchRequest();
+    request.withContentOrSourceParamParserOrNull (parser ->
+        parseSearchRequest (searchRequest, request, parser, setSize));
+    ...
+}
+

3.1.1 构造目的shard列表

将请求涉及的本集群shard列表和远程集群的shard列表(远程集群用于跨集群访问)合并:

private void executeSearch(.. .) {
+  ...
+    final GroupShardsIterator<SearchShardIterator> shardIterators = mergeShardsIterators(localShardIterators, remoteShardIterators);
+    localShardIterators = StreamSupport.stream(localShardRoutings.spliterator(), false).map(it -> {
+    OriginalIndices finalIndices = finalIndicesMap.get(it.shardId().getIndex().getUUID());
+    assert finalIndices != null;
+    return new SearchShardIterator(searchRequest.getLocalClusterAlias(), it.shardId(), it.getShardRoutings(), finalIndices);
+    }).collect(Collectors.toList());
+	...
+}
+

查看结果

241
241

3.1.2 对所有分片进行搜索

AbstractSearchAsyncAction.run
+对每个分片进行搜索查询
+for (int i = 0; i < shardsIts.size(); i++) {
+    final SearchShardIterator shardRoutings = shardsIts.get(i);
+    assert shardRoutings.skip() == false;
+    assert shardIndexMap.containsKey(shardRoutings);
+    int shardIndex = shardIndexMap.get(shardRoutings);
+    performPhaseOnShard(shardIndex, shardRoutings, shardRoutings.nextOrNull());
+}
+

其中shardsIts是所有aaaa*的所有索引+其中一个副本

2141
2141

3.1.3 分片具体的搜索过程

AbstractSearchAsyncAction.performPhaseOnShard
+private void performPhaseOnShard(. ..) {
+    executePhaseOnShard(.. .) {
+        //收到执行成功的回复
+        public void inne rOnResponse (FirstResult result) {
+            maybeFork (thread, () -> onShardResult (result,shardIt) );
+        }
+        //收到执行失败的回复
+        public void onFailure (Exception t) {
+            maybeFork(thread, () -> onShardFailure (shardIndex, shard, shard. currentNodeId(),shardIt, t));
+        }
+    });
+}
+

分片结果,当前线程

//AbstractSearchAsyncAction.onShardResult
+...
+private void onShardResult (FirstResult result, SearchShardIterator shardIt) {
+    onShardSuccess(result);
+    success fulShardExecution(shardIt);
+}
+...
+//AbstractSearchAsyncAction.onShardResultConsumed
+private void successfulShardExecution (SearchShardIterator shardsIt) {
+    //计数器累加.
+    final int xTotalOps = totalOps.addAndGet (remainingOpsOnIterator);
+    //检查是否收到全部回复
+    if (xTotalOps == expectedTotalOps) {
+        onPhaseDone ();
+    } else if (xTota1Ops > expectedTotal0ps) {
+        throw new AssertionError(. ..);
+    }
+}
+
+
412
412

此处忽略了搜索结果totalHits为0的结果,并将结果进行累加,当xTotalOps等于expectedTotalOps时开始AbstractSearchAsyncAction.onPhaseDone再进行AbstractSearchAsyncAction.executeNextPhase取回阶段

3.2 Fetch阶段

',19),A={href:"https://www.elastic.co/Zephery/en/elasticsearch/Zephery/current/_fetch_phase.html",target:"_blank",rel:"noopener noreferrer"},P=e('
412412
412412

(1)各个shard 返回的只是各文档的id和排序值 IDs and sort values ,coordinate node根据这些id&sort values 构建完priority queue之后,然后把程序需要的document 的id发送mget请求去所有shard上获取对应的document

(2)各个shard将document返回给coordinate node

(3)coordinate node将合并后的document结果返回给client客户端

3.2.1 FetchSearchPhase(对应上面的1)

Query阶段的executeNextPhase方法触发Fetch阶段,Fetch阶段的起点为FetchSearchPhase#innerRun函数,从查询阶段的shard列表中遍历,跳过查询结果为空的shard,对特定目标shard执行executeFetch来获取数据,其中包括分页信息。对scroll请求的处理也在FetchSearchPhase#innerRun函数中。

private void innerRun() throws Exception {
+    final int numShards = context.getNumShards();
+    final boolean isScrollSearch = context.getRequest().scroll() != null;
+    final List<SearchPhaseResult> phaseResults = queryResults.asList();
+    final SearchPhaseController.ReducedQueryPhase reducedQueryPhase = resultConsumer.reduce();
+    final boolean queryAndFetchOptimization = queryResults.length() == 1;
+    final Runnable finishPhase = () -> moveToNextPhase(
+        searchPhaseController,
+        queryResults,
+        reducedQueryPhase,
+        queryAndFetchOptimization ? queryResults : fetchResults.getAtomicArray()
+    );
+            for (int i = 0; i < docIdsToLoad.length; i++) {
+                IntArrayList entry = docIdsToLoad[i];
+                SearchPhaseResult queryResult = queryResults.get(i);
+                if (entry == null) { 
+                    if (queryResult != null) {
+                        releaseIrrelevantSearchContext(queryResult.queryResult());
+                        progressListener.notifyFetchResult(i);
+                    }
+                    counter.countDown();
+                }else{
+                    executeFetch(
+                            queryResult.getShardIndex(),
+                            shardTarget,
+                            counter,
+                            fetchSearchRequest,
+                            queryResult.queryResult(),
+                            connection
+                        );
+                }
+        }
+    }
+}
+

再看源码:

启动一个线程来fetch
+AbstractSearchAsyncAction.executePhase->FetchSearchPhase.run->FetchSearchPhase.innerRun->FetchSearchPhase.executeFetch
+
+private void executeFetch(...) {
+    context.getSearchTransport()
+        .sendExecuteFetch(
+            connection,
+            fetchSearchRequest,
+            context.getTask(),
+            new SearchActionListener<FetchSearchResult>(shardTarget, shardIndex) {
+                @Override
+                public void innerOnResponse(FetchSearchResult result) {
+                  progressListener.notifyFetchResult(shardIndex);
+                  counter.onResult(result);
+                }
+
+                @Override
+                public void onFailure(Exception e) {
+                  progressListener.notifyFetchFailure(shardIndex, shardTarget, e);
+                  counter.onFailure(shardIndex, shardTarget, e);
+                }
+            }
+        );
+}
+  
+
13413
13413

counter是一个收集器CountedCollector,onResult(result)主要是每次收到的shard数据存放,并且执行一次countDown,当所有shard数据收集完之后,然后触发一次finishPhase。

# CountedCollector.class
+void countDown() {
+    assert counter.isCountedDown() == false : "more operations executed than specified";
+    if (counter.countDown()) {
+        onFinish.run();
+    }
+}
+

moveToNextPhase方法执行下一阶段,下-阶段要执行的任务定义在FetchSearchPhase构造 函数中,主要是触发ExpandSearchPhase。

3.2.2 ExpandSearchPhase(对应上图的2)

AbstractSearchAsyncAction.executePhase->ExpandSearchPhase.run。取回阶段完成之后执行ExpandSearchPhase#run,主要判断是否启用字段折叠,根据需要实现字段折叠功能,如果没有实现字段折叠,则直接返回给客户端。

image-20220317000858513
image-20220317000858513

ExpandSearchPhase执行完之后回复客户端,在AbstractSearchAsyncAction.sendSearchResponse方法中实现:

412412
412412

四、数据节点

4.1 执行query、fetch流程

执行本流程的线程池: search。

对各种Query请求的处理入口注册于SearchTransportService.registerRequestHandler。

public static void registerRequestHandler(TransportService transportService, SearchService searchService) {
+  ...
+  transportService.registerRequestHandler(
+    QUERY_ACTION_NAME,
+    ThreadPool.Names.SAME,
+    ShardSearchRequest::new,
+    (request, channel, task) -> searchService.executeQueryPhase(
+      request,
+      (SearchShardTask) task,
+      new ChannelActionListener<>(channel, QUERY_ACTION_NAME, request)
+    )
+  );
+  ...
+}
+

4.1.1 执行query请求

# SearchService
+public void executeQueryPhase(ShardSearchRequest request, SearchShardTask task, ActionListener<SearchPhaseResult> listener) {
+    assert request.canReturnNullResponseIfMatchNoDocs() == false || request.numberOfShards() > 1
+        : "empty responses require more than one shard";
+    final IndexShard shard = getShard(request);
+    rewriteAndFetchShardRequest(shard, request, listener.delegateFailure((l, orig) -> {
+        ensureAfterSeqNoRefreshed(shard, orig, () -> executeQueryPhase(orig, task), l);
+    }));
+}
+

其中ensureAfterSeqNoRefreshed是把request任务放到一个名为search的线程池里面执行,容量大小为1000。

1
1

主要是用来执行SearchService.executeQueryPhase->SearchService.loadOrExecuteQueryPhase->QueryPhase.execute。核心的查询封装在queryPhase.execute(context)中,其中调用Lucene实现检索,同时实现聚合:

public void execute (SearchContext searchContext) {
+    aggregationPhase.preProcess (searchContext);
+    boolean rescore = execute ( searchContext, searchContext.searcher(), searcher::setCheckCancelled, indexSort);
+    if (rescore) {
+        rescorePhase.execute (searchContext);
+        suggestPhase.execute (searchContext);
+        aggregationPhase.execute (searchContext);
+    }
+}
+

其中包含几个核心功能:

  • execute(),调用Lucene、searcher.search()实现搜索
  • rescorePhase,全文检索且需要打分
  • suggestPhase,自动补全及纠错
  • aggregationPhase,实现聚合

4.1.2 fetch流程

对各种Fetch请求的处理入口注册于SearchTransportService.registerRequestHandler。

transportService.registerRequestHandler(
+    QUERY_FETCH_SCROLL_ACTION_NAME,
+    ThreadPool.Names.SAME,
+    InternalScrollSearchRequest::new,
+    (request, channel, task) -> {
+        searchService.executeFetchPhase(
+            request,
+            (SearchShardTask) task,
+            new ChannelActionListener<>(channel, QUERY_FETCH_SCROLL_ACTION_NAME, request)
+        );
+    }
+);
+

对Fetch响应的实现封装在SearchService.executeFetchPhase中,核心是调用fetchPhase.execute(context)。按照命中的doc取得相关数据,填充到SearchHits中,最终封装到FetchSearchResult中。

# FetchPhase
+public void execute(SearchContext context) {
+    Profiler profiler = context.getProfilers() == null ? Profiler.NOOP : context.getProfilers().startProfilingFetchPhase();
+    SearchHits hits = null;
+    try {
+      //lucene构建搜索的结果
+        hits = buildSearchHits(context, profiler);
+    } finally {
+        ProfileResult profileResult = profiler.finish();
+        // Only set the shardResults if building search hits was successful
+        if (hits != null) {
+            context.fetchResult().shardResult(hits, profileResult);
+        }
+    }
+}
+

五、数据返回

入口:RestCancellableNodeClient.doExecute
Task task = client.executeLocally主要执行查询,并使用了ActionListener来进行监听
image-20220319003638991

其中onResponse的调用链路如下:RestActionListener.onResponse->RestResponseListener.processResponse->RestController.sendResponse->DefaultRestChannel.sendResponse->Netty4HttpChannel.sendResponse

public void sendResponse(RestResponse restResponse) {
+  ...
+   httpChannel.sendResponse(httpResponse, listener);
+  ...
+}
+
+

最后由Netty4HttpChannel.sendResponse来响应请求。

六、总结

当我们以aaaa*这样来搜索的时候,实际上查询了所有匹配以aaaa开头的索引,并且对所有的索引的分片都进行了一次Query,再然后对有结果的分片进行一次fetch,最终才能展示结果。可能觉得好奇,对所有分片都进行一次搜索,遍历分片所有的Lucene分段,会不会太过于消耗资源,因此合并Lucene分段对搜索性能有好处,这里下篇文章在讲吧。同时,聚合是发生在fetch过程中的,并不是lucene。

本文参考

`,44),T={href:"https://weread.qq.com/web/reader/f9c32dc07184876ef9cdeb6k7f33291023d7f39f8317e0b",target:"_blank",rel:"noopener noreferrer"},C={href:"https://www.jianshu.com/p/b77e80d6c18e",target:"_blank",rel:"noopener noreferrer"},j={href:"https://www.jianshu.com/p/7174cf716790",target:"_blank",rel:"noopener noreferrer"},E={href:"https://www.jianshu.com/p/f5a61653708e",target:"_blank",rel:"noopener noreferrer"},F={href:"https://zhuanlan.zhihu.com/p/36940048",target:"_blank",rel:"noopener noreferrer"},I={href:"https://juejin.cn/post/6994755077659426846",target:"_blank",rel:"noopener noreferrer"};function H(N,O){const a=c("ExternalLinkIcon");return o(),i("div",null,[x,n("p",null,[s("一个搜索请求必须询问请求的索引中所有分片的某个副本来进行匹配。假设一个索引有5个主分片,每个主分片有1个副分片,共10个分片,一次搜索请求会由5个分片来共同完成,它们可能是主分片,也可能是副分片。也就是说,一次搜索请求只会命中所有分片副本中的一个。当搜索任务执行在分布式系统上时,整体流程如下图所示。图片来源"),n("a",w,[s("Elasitcsearch源码解析与优化实战"),t(a)])]),S,n("p",null,[s("图片来源"),n("a",R,[s("官网"),t(a)]),s(",比较旧,但任然可用")]),_,n("p",null,[s("取回阶段,图片来自"),n("a",A,[s("官网"),t(a)]),s(",")]),P,n("ol",null,[n("li",null,[n("a",T,[s("Elasitcsearch源码解析与优化实战"),t(a)])]),n("li",null,[n("a",C,[s("Elasticsearch源码分析-搜索分析(一)"),t(a)])]),n("li",null,[n("a",j,[s("Elasticsearch源码分析-搜索分析(二)"),t(a)])]),n("li",null,[n("a",E,[s("Elasticsearch源码分析-搜索分析(三)"),t(a)])]),n("li",null,[n("a",F,[s("Elasticsearch 通信模块的分析"),t(a)])]),n("li",null,[n("a",I,[s("Elasticsearch 网络通信线程分析"),t(a)])])])])}const D=p(q,[["render",H],["__file","【elasticsearch】搜索过程详解.html.vue"]]);export{D as default}; diff --git "a/assets/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html-BEtyUgY9.js" "b/assets/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html-BEtyUgY9.js" new file mode 100644 index 00000000..bfa68bcd --- /dev/null +++ "b/assets/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html-BEtyUgY9.js" @@ -0,0 +1,9 @@ +import{_ as i}from"./plugin-vue_export-helper-x3n3nnut.js";import{r,o,c as p,a,d as e,b as s,e as t}from"./app-hbwtiwmf.js";const c={},l=t(`

一次jvm调优过程

前端时间把公司的一个分布式定时调度的系统弄上了容器云,部署在kubernetes,在容器运行的动不动就出现问题,特别容易jvm溢出,导致程序不可用,终端无法进入,日志一直在刷错误,kubernetes也没有将该容器自动重启。业务方基本每天都在反馈task不稳定,后续就协助接手看了下,先主要讲下该程序的架构吧。
该程序task主要分为三个模块:
console进行一些cron的配置(表达式、任务名称、任务组等);
schedule主要从数据库中读取配置然后装载到quartz再然后进行命令下发;
client接收任务执行,然后向schedule返回运行的信息(成功、失败原因等)。
整体架构跟github上开源的xxl-job类似,也可以参考一下。

1. 启用jmx和远程debug模式

容器的网络使用了BGP,打通了公司的内网,所以可以直接通过ip来进行程序的调试,主要是在启动的jvm参数中添加:

JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=0.0.0.0:8000,server=y,suspend=n "
+JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
+

其中,调试模式的address最好加上0.0.0.0,有时候通过netstat查看端口的时候,该位置显示为127.0.0.1,导致无法正常debug,开启了jmx之后,可以初步观察堆内存的情况。

堆内存(特别是cms的old gen),初步看代码觉得是由于用了大量的map,本地缓存了大量数据,怀疑是每次定时调度的信息都进行了保存。

2. memory analyzer、jprofiler进行堆内存分析

先从容器中dump出堆内存

jmap -dump:live,format=b,file=heap.hprof 58
+

由图片可以看出,这些大对象不过也就10M,并没有想象中的那么大,所以并不是大对象的问题,后续继续看了下代码,虽然每次请求都会把信息放进map里,如果能正常调通的话,就会移除map中保存的记录,由于是测试环境,执行端很多时候都没有正常运行,甚至说业务方关闭了程序,导致调度一直出现问题,所以map的只会保留大量的错误请求。不过相对于该程序的堆内存来说,不是主要问题。

3. netty的方面的考虑

另一个小伙伴一直怀疑的是netty这一块有错误,着重看了下。该程序用netty自己实现了一套rpc,调度端每次进行命令下发的时候都会通过netty的rpc来进行通信,整个过程逻辑写的很混乱,下面开始排查。
首先是查看堆内存的中占比:

可以看出,io.netty.channel.nio.NioEventLoop的占比达到了40%左右,再然后是io.netty.buffer.PoolThreadCache,占比大概达到33%左右。猜想可能是传输的channel没有关闭,还是NioEventLoop没有关闭。再跑去看一下jmx的线程数:

达到了惊人的1000个左右,而且一直在增长,没有过下降的趋势,再次猜想到可能是NioEventLoop没有关闭,在代码中全局搜索NioEventLoop,找到一处比较可疑的地方。

声明了一个NioEventLoopGroup的成员变量,通过构造方法进行了初始化,但是在执行syncRequest完之后并没有进行对group进行shutdownGracefully操作,外面对其的操作并没有对该类的group对象进行关闭,导致线程数一直在增长。

最终解决办法:
在调用完syncRequest方法时,对ChannelBootStrap的group对象进行行shutdownGracefully

提交代码,容器中继续测试,可以基本看出,线程基本处于稳定状态,并不会出现一直增长的情况了

还原本以为基本解决了,到最后还是发现,堆内存还算稳定,但是,直接内存依旧打到了100%,虽然程序没有挂掉,所以,上面做的,可能仅仅是为这个程序续命了而已,感觉并没有彻底解决掉问题。

4. 直接内存排查

第一个想到的就是netty的直接内存,关掉,命令如下:

-Dio.netty.noPreferDirect=true -Dio.netty.leakDetectionLevel=advanced
+

查看了一下java的nio直接内存,发现也就几十kb,然而直接内存还是慢慢往上涨。毫无头绪,然后开始了自己的从linux层面开始排查问题

5. 推荐的直接内存排查方法

5.1 pmap

一般配合pmap使用,从内核中读取内存块,然后使用views 内存块来判断错误,我简单试了下,乱码,都是二进制的东西,看不出所以然来。

pmap -d 58  | sort -n -k2
+pmap -x 58  | sort -n -k3
+grep rw-p /proc/$1/maps | sed -n 's/^\\([0-9a-f]*\\)-\\([0-9a-f]*\\) .*$/\\1 \\2/p' | while read start stop; do gdb --batch --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
+

这个时候真的懵了,不知道从何入手了,难道是linux操作系统方面的问题?

`,39),d={id:"_5-2-gperftools-https-github-com-gperftools-gperftools",tabindex:"-1"},u=a("a",{class:"header-anchor",href:"#_5-2-gperftools-https-github-com-gperftools-gperftools","aria-hidden":"true"},"#",-1),h={href:"https://github.com/gperftools/gperftools%EF%BC%89",target:"_blank",rel:"noopener noreferrer"},m=t(`

起初,在网上看到有人说是因为linux自带的glibc版本太低了,导致的内存溢出,考虑一下。初步觉得也可能是因为这个问题,所以开始慢慢排查。oracle官方有一个jemalloc用来替换linux自带的,谷歌那边也有一个tcmalloc,据说性能比glibc、jemalloc都强,开始换一下。
根据网上说的,在容器里装libunwind,然后再装perf-tools,然后各种捣鼓,到最后发现,执行不了,

pprof --text /usr/bin/java java_58.0001.heap
+

看着工具高大上的,似乎能找出linux的调用栈,

6. 意外的结果

毫无头绪的时候,回想到了linux的top命令以及日志情况,测试环境是由于太多执行端业务方都没有维护,导致调度系统一直会出错,一出错就会导致大量刷错误日志,平均一天一个容器大概就有3G的日志,cron一旦到准点,就会有大量的任务要同时执行,而且容器中是做了对io的限制,磁盘也限制为10G,导致大量的日志都堆积在buff/cache里面,最终直接内存一直在涨,这个时候,系统不会挂,但是先会一直显示内存使用率达到100%。
修复后的结果如下图所示:

总结

定时调度这个系统当时并没有考虑到公司的系统会用的这么多,设计的时候也仅仅是为了实现上千的量,没想到到最后变成了一天的调度都有几百万次。最初那批开发也就使用了大量的本地缓存map来临时存储数据,然后面向简历编程各种用netty自己实现了通信的方式,一堆坑都留给了后人。目前也算是解决掉了一个由于线程过多导致系统不可用的情况而已,但是由于存在大量的map,系统还是得偶尔重启一下比较好。

`,10),g=a("br",null,null,-1),b={href:"https://www.cnblogs.com/testfan2019/p/11151008.html",target:"_blank",rel:"noopener noreferrer"},f=a("br",null,null,-1),v={href:"https://coldwalker.com/2018/08//troubleshooter_native_memory_increase/",target:"_blank",rel:"noopener noreferrer"},_=a("br",null,null,-1),k={href:"https://static.rainfocus.com/oracle/oow18/sess/1524505564465001W0mS/PF/Troubleshooting_native_memory_leaks_1540301908390001k6DR.pdf",target:"_blank",rel:"noopener noreferrer"};function x(y,w){const n=r("ExternalLinkIcon");return o(),p("div",null,[l,a("h4",d,[u,e(" 5.2 [gperftools]("),a("a",h,[e("https://github.com/gperftools/gperftools)"),s(n)])]),m,a("p",null,[e("参考:"),g,e(" 1."),a("a",b,[e("记一次线上内存泄漏问题的排查过程"),s(n)]),f,e(" 2."),a("a",v,[e("Java堆外内存增长问题排查Case"),s(n)]),_,e(" 3."),a("a",k,[e("Troubleshooting Native Memory Leaks in Java Applications"),s(n)])])])}const N=i(c,[["render",x],["__file","一次jvm调优过程.html.vue"]]);export{N as default}; diff --git "a/assets/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html-xuuwYmgp.js" "b/assets/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html-xuuwYmgp.js" new file mode 100644 index 00000000..82789b84 --- /dev/null +++ "b/assets/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html-xuuwYmgp.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-399e07b6","path":"/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html","title":"一次jvm调优过程","lang":"zh-CN","frontmatter":{"description":"一次jvm调优过程 前端时间把公司的一个分布式定时调度的系统弄上了容器云,部署在kubernetes,在容器运行的动不动就出现问题,特别容易jvm溢出,导致程序不可用,终端无法进入,日志一直在刷错误,kubernetes也没有将该容器自动重启。业务方基本每天都在反馈task不稳定,后续就协助接手看了下,先主要讲下该程序的架构吧。 该程序task主要分为三个模块: console进行一些cron的配置(表达式、任务名称、任务组等); schedule主要从数据库中读取配置然后装载到quartz再然后进行命令下发; client接收任务执行,然后向schedule返回运行的信息(成功、失败原因等)。 整体架构跟github上开源的xxl-job类似,也可以参考一下。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"一次jvm调优过程"}],["meta",{"property":"og:description","content":"一次jvm调优过程 前端时间把公司的一个分布式定时调度的系统弄上了容器云,部署在kubernetes,在容器运行的动不动就出现问题,特别容易jvm溢出,导致程序不可用,终端无法进入,日志一直在刷错误,kubernetes也没有将该容器自动重启。业务方基本每天都在反馈task不稳定,后续就协助接手看了下,先主要讲下该程序的架构吧。 该程序task主要分为三个模块: console进行一些cron的配置(表达式、任务名称、任务组等); schedule主要从数据库中读取配置然后装载到quartz再然后进行命令下发; client接收任务执行,然后向schedule返回运行的信息(成功、失败原因等)。 整体架构跟github上开源的xxl-job类似,也可以参考一下。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"一次jvm调优过程\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"1. 启用jmx和远程debug模式","slug":"_1-启用jmx和远程debug模式","link":"#_1-启用jmx和远程debug模式","children":[]},{"level":2,"title":"2. memory analyzer、jprofiler进行堆内存分析","slug":"_2-memory-analyzer、jprofiler进行堆内存分析","link":"#_2-memory-analyzer、jprofiler进行堆内存分析","children":[]},{"level":2,"title":"3. netty的方面的考虑","slug":"_3-netty的方面的考虑","link":"#_3-netty的方面的考虑","children":[]},{"level":2,"title":"4. 直接内存排查","slug":"_4-直接内存排查","link":"#_4-直接内存排查","children":[]},{"level":2,"title":"5. 推荐的直接内存排查方法","slug":"_5-推荐的直接内存排查方法","link":"#_5-推荐的直接内存排查方法","children":[]},{"level":2,"title":"6. 意外的结果","slug":"_6-意外的结果","link":"#_6-意外的结果","children":[]},{"level":2,"title":"总结","slug":"总结","link":"#总结","children":[]}],"git":{"createdTime":1706066758000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":6.23,"words":1870},"filePathRelative":"java/一次jvm调优过程.md","localizedDate":"2024年1月24日","excerpt":"

一次jvm调优过程

\\n

前端时间把公司的一个分布式定时调度的系统弄上了容器云,部署在kubernetes,在容器运行的动不动就出现问题,特别容易jvm溢出,导致程序不可用,终端无法进入,日志一直在刷错误,kubernetes也没有将该容器自动重启。业务方基本每天都在反馈task不稳定,后续就协助接手看了下,先主要讲下该程序的架构吧。
\\n该程序task主要分为三个模块:
\\nconsole进行一些cron的配置(表达式、任务名称、任务组等);
\\nschedule主要从数据库中读取配置然后装载到quartz再然后进行命令下发;
\\nclient接收任务执行,然后向schedule返回运行的信息(成功、失败原因等)。
\\n整体架构跟github上开源的xxl-job类似,也可以参考一下。

","autoDesc":true}');export{e as data}; diff --git "a/assets/\345\206\205\345\255\230\345\261\217\351\232\234.html-5JCsVv6o.js" "b/assets/\345\206\205\345\255\230\345\261\217\351\232\234.html-5JCsVv6o.js" new file mode 100644 index 00000000..24192ac0 --- /dev/null +++ "b/assets/\345\206\205\345\255\230\345\261\217\351\232\234.html-5JCsVv6o.js" @@ -0,0 +1 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as a,c as d,a as e,d as o}from"./app-hbwtiwmf.js";const r={},l=e("h1",{id:"内存屏障",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#内存屏障","aria-hidden":"true"},"#"),o(" 内存屏障")],-1),_=e("p",null,[o("四个内存屏障指令:LoadLoad"),e("code",null,","),o("StoreStore"),e("code",null,","),o("LoadStore"),e("code",null,","),o("StoreLoad")],-1),c=e("p",null,"在每个volatile写操作前插入StoreStore屏障,这样就能让其他线程修改A变量后,把修改的值对当前线程可见,在写操作后插入StoreLoad屏障,这样就能让其他线程获取A变量的时候,能够获取到已经被当前线程修改的值",-1),n=e("p",null,"在每个volatile读操作前插入LoadLoad屏障,这样就能让当前线程获取A变量的时候,保证其他线程也都能获取到相同的值,这样所有的线程读取的数据就一样了,在读操作后插入LoadStore屏障;这样就能让当前线程在其他线程修改A变量的值之前,获取到主内存里面A变量的的值。",-1),s=[l,_,c,n];function i(h,u){return a(),d("div",null,s)}const p=t(r,[["render",i],["__file","内存屏障.html.vue"]]);export{p as default}; diff --git "a/assets/\345\206\205\345\255\230\345\261\217\351\232\234.html-YpsEGPcG.js" "b/assets/\345\206\205\345\255\230\345\261\217\351\232\234.html-YpsEGPcG.js" new file mode 100644 index 00000000..fa8cee42 --- /dev/null +++ "b/assets/\345\206\205\345\255\230\345\261\217\351\232\234.html-YpsEGPcG.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-660266c1","path":"/java/%E5%86%85%E5%AD%98%E5%B1%8F%E9%9A%9C.html","title":"内存屏障","lang":"zh-CN","frontmatter":{"description":"内存屏障 四个内存屏障指令:LoadLoad,StoreStore,LoadStore,StoreLoad 在每个volatile写操作前插入StoreStore屏障,这样就能让其他线程修改A变量后,把修改的值对当前线程可见,在写操作后插入StoreLoad屏障,这样就能让其他线程获取A变量的时候,能够获取到已经被当前线程修改的值 在每个volatile读操作前插入LoadLoad屏障,这样就能让当前线程获取A变量的时候,保证其他线程也都能获取到相同的值,这样所有的线程读取的数据就一样了,在读操作后插入LoadStore屏障;这样就能让当前线程在其他线程修改A变量的值之前,获取到主内存里面A变量的的值。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/%E5%86%85%E5%AD%98%E5%B1%8F%E9%9A%9C.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"内存屏障"}],["meta",{"property":"og:description","content":"内存屏障 四个内存屏障指令:LoadLoad,StoreStore,LoadStore,StoreLoad 在每个volatile写操作前插入StoreStore屏障,这样就能让其他线程修改A变量后,把修改的值对当前线程可见,在写操作后插入StoreLoad屏障,这样就能让其他线程获取A变量的时候,能够获取到已经被当前线程修改的值 在每个volatile读操作前插入LoadLoad屏障,这样就能让当前线程获取A变量的时候,保证其他线程也都能获取到相同的值,这样所有的线程读取的数据就一样了,在读操作后插入LoadStore屏障;这样就能让当前线程在其他线程修改A变量的值之前,获取到主内存里面A变量的的值。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-24T10:30:22.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-24T10:30:22.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"内存屏障\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-24T10:30:22.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706066758000,"updatedTime":1706092222000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.69,"words":208},"filePathRelative":"java/内存屏障.md","localizedDate":"2024年1月24日","excerpt":"

内存屏障

\\n

四个内存屏障指令:LoadLoad,StoreStore,LoadStore,StoreLoad

\\n

在每个volatile写操作前插入StoreStore屏障,这样就能让其他线程修改A变量后,把修改的值对当前线程可见,在写操作后插入StoreLoad屏障,这样就能让其他线程获取A变量的时候,能够获取到已经被当前线程修改的值

\\n

在每个volatile读操作前插入LoadLoad屏障,这样就能让当前线程获取A变量的时候,保证其他线程也都能获取到相同的值,这样所有的线程读取的数据就一样了,在读操作后插入LoadStore屏障;这样就能让当前线程在其他线程修改A变量的值之前,获取到主内存里面A变量的的值。

","autoDesc":true}');export{e as data}; diff --git "a/assets/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html-ZOZveUV6.js" "b/assets/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html-ZOZveUV6.js" new file mode 100644 index 00000000..c288d983 --- /dev/null +++ "b/assets/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html-ZOZveUV6.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-90f2343c","path":"/java/%E5%9C%A8%20Spring%206%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%99%9A%E6%8B%9F%E7%BA%BF%E7%A8%8B.html","title":"在 Spring 6 中使用虚拟线程","lang":"zh-CN","frontmatter":{"description":"在 Spring 6 中使用虚拟线程 一、简介 在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。 虚拟线程是Java 19 的预览功能,这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。Spring 6 版本最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/%E5%9C%A8%20Spring%206%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%99%9A%E6%8B%9F%E7%BA%BF%E7%A8%8B.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"在 Spring 6 中使用虚拟线程"}],["meta",{"property":"og:description","content":"在 Spring 6 中使用虚拟线程 一、简介 在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。 虚拟线程是Java 19 的预览功能,这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。Spring 6 版本最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:image","content":"http://www.wenzhihuai.com/"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T13:13:41.000Z"}],["meta",{"name":"twitter:card","content":"summary_large_image"}],["meta",{"name":"twitter:image:alt","content":"在 Spring 6 中使用虚拟线程"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T13:13:41.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"在 Spring 6 中使用虚拟线程\\",\\"image\\":[\\"http://www.wenzhihuai.com/\\"],\\"dateModified\\":\\"2024-01-25T13:13:41.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、简介","slug":"一、简介","link":"#一、简介","children":[]},{"level":2,"title":"二、 虚拟线程与平台线程","slug":"二、-虚拟线程与平台线程","link":"#二、-虚拟线程与平台线程","children":[]},{"level":2,"title":"三、在Spring 6中使用虚拟线程","slug":"三、在spring-6中使用虚拟线程","link":"#三、在spring-6中使用虚拟线程","children":[]},{"level":2,"title":"四、性能比较","slug":"四、性能比较","link":"#四、性能比较","children":[]}],"git":{"createdTime":1706186538000,"updatedTime":1706188421000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":4.81,"words":1442},"filePathRelative":"java/在 Spring 6 中使用虚拟线程.md","localizedDate":"2024年1月25日","excerpt":"

在 Spring 6 中使用虚拟线程

\\n

一、简介

\\n

在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。

\\n

虚拟线程是Java 19 的预览功能,这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。Spring 6 版本最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。

","autoDesc":true}');export{e as data}; diff --git "a/assets/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html-ix-0C20g.js" "b/assets/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html-ix-0C20g.js" new file mode 100644 index 00000000..2a2d408f --- /dev/null +++ "b/assets/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html-ix-0C20g.js" @@ -0,0 +1,60 @@ +import{_ as o}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as p,o as c,c as l,a as n,d as a,b as e,e as t}from"./app-hbwtiwmf.js";const i="/assets/755525-20230827193604936-1596575555-InMR9nhl.png",r="/assets/755525-20230827193604663-146471729-Dklv6VTq.png",u="/assets/755525-20230827193609186-1264647264-45xPkPYe.png",d={},k=n("h1",{id:"在-spring-6-中使用虚拟线程",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#在-spring-6-中使用虚拟线程","aria-hidden":"true"},"#"),a(" 在 Spring 6 中使用虚拟线程")],-1),v=n("h2",{id:"一、简介",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#一、简介","aria-hidden":"true"},"#"),a(" 一、简介")],-1),g=n("p",null,"在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。",-1),m={href:"https://openjdk.org/jeps/425",target:"_blank",rel:"noopener noreferrer"},b={href:"https://spring.io/blog/2022/10/11/embracing-virtual-threads",target:"_blank",rel:"noopener noreferrer"},h=n("p",null,"首先,我们将看到“平台线程”和“虚拟线程”之间的主要区别。接下来,我们将使用虚拟线程从头开始构建一个 Spring-Boot 应用程序。最后,我们将创建一个小型测试套件,以查看简单 Web 应用程序吞吐量的最终改进。",-1),_=n("h2",{id:"二、-虚拟线程与平台线程",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#二、-虚拟线程与平台线程","aria-hidden":"true"},"#"),a(" 二、 虚拟线程与平台线程")],-1),f={href:"https://www.baeldung.com/java-virtual-thread-vs-thread",target:"_blank",rel:"noopener noreferrer"},w=n("p",null,"对于本教程来说,必须了解虚拟线程的运行成本远低于平台线程。它们消耗的分配内存量要少得多。这就是为什么可以创建数百万个虚拟线程而不会出现内存不足问题,而不是使用标准平台(或内核)线程创建几百个虚拟线程。",-1),x=n("p",null,"从理论上讲,这赋予了开发人员一种超能力:无需依赖异步代码即可管理高度可扩展的应用程序。",-1),y=n("h2",{id:"三、在spring-6中使用虚拟线程",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#三、在spring-6中使用虚拟线程","aria-hidden":"true"},"#"),a(" 三、在Spring 6中使用虚拟线程")],-1),T={href:"https://www.baeldung.com/java-preview-features",target:"_blank",rel:"noopener noreferrer"},j=n("em",null,"代码",-1),E=t(`
<build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+                <source>19</source>
+                <target>19</target>
+                <compilerArgs>
+                    --enable-preview
+                </compilerArgs>
+            </configuration>
+        </plugin>
+    </plugins>
+</build>
+

从 Java 的角度来看,要使用 Apache Tomcat 和虚拟线程,我们需要一个带有几个 bean 的简单配置类:

@EnableAsync
+@Configuration
+@ConditionalOnProperty(
+  value = "spring.thread-executor",
+  havingValue = "virtual"
+)
+public class ThreadConfig {
+    @Bean
+    public AsyncTaskExecutor applicationTaskExecutor() {
+        return new TaskExecutorAdapter(Executors.newVirtualThreadPerTaskExecutor());
+    }
+
+    @Bean
+    public TomcatProtocolHandlerCustomizer<?> protocolHandlerVirtualThreadExecutorCustomizer() {
+        return protocolHandler -> {
+            protocolHandler.setExecutor(Executors.newVirtualThreadPerTaskExecutor());
+        };
+    }
+}
+
`,3),S=n("em",null,"ApplicationTaskExecutor",-1),C={href:"https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.html",target:"_blank",rel:"noopener noreferrer"},q=n("em",null,"Executor",-1),P=n("em",null,"将以相同的方式 自定义标准",-1),V={href:"https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/coyote/ProtocolHandler.html",target:"_blank",rel:"noopener noreferrer"},B=n("em",null,"我们还添加了注释",-1),I={href:"https://www.baeldung.com/spring-conditionalonproperty",target:"_blank",rel:"noopener noreferrer"},L=t(`
spring:
+    thread-executor: virtual
+    //...
+

我们来测试一下Spring Boot应用程序是否使用虚拟线程来处理Web请求调用。为此,我们需要构建一个简单的控制器来返回所需的信息:

@RestController
+@RequestMapping("/thread")
+public class ThreadController {
+    @GetMapping("/name")
+    public String getThreadName() {
+        return Thread.currentThread().toString();
+    }
+}
+
`,3),M={href:"https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/Thread.html",target:"_blank",rel:"noopener noreferrer"},A={href:"https://www.baeldung.com/curl-rest",target:"_blank",rel:"noopener noreferrer"},J=n("em",null,"curl",-1),H=t(`
$ curl -s http://localhost:8080/thread/name
+$ VirtualThread[#171]/runnable@ForkJoinPool-1-worker-4
+

正如我们所看到的,响应明确表示我们正在使用虚拟线程来处理此 Web 请求。换句话说,*Thread.currentThread()*调用返回虚拟线程类的实例。现在让我们通过简单但有效的负载测试来看看虚拟线程的有效性。

四、性能比较

`,3),R={href:"https://www.baeldung.com/jmeter",target:"_blank",rel:"noopener noreferrer"},N=t(`

在这种特殊的场景中,我们将调用Rest Controller中的一个端点,该端点将简单地让执行休眠一秒钟,模拟复杂的异步任务:

@RestController
+@RequestMapping("/load")
+public class LoadTestController {
+
+    private static final Logger LOG = LoggerFactory.getLogger(LoadTestController.class);
+
+    @GetMapping
+    public void doSomething() throws InterruptedException {
+        LOG.info("hey, I'm doing something");
+        Thread.sleep(1000);
+    }
+}
+

请记住,由于*@ConditionalOnProperty* 注释,我们只需更改 application.yaml 中变量的值即可在虚拟线程和标准线程之间切换

JMeter 测试将仅包含一个线程组,模拟 1000 个并发用户访问*/load* 端点 100 秒:

image-20230827193431807
image-20230827193431807

在本例中,采用这一新功能所带来的性能提升是显而易见的。让我们比较不同实现的“响应时间图”。这是标准线程的响应图。我们可以看到,立即完成一次调用所需的时间达到 5000 毫秒:

image-20230827193511176
image-20230827193511176

发生这种情况是因为平台线程是一种有限的资源,当所有计划的和池化的线程都忙时,Spring 应用程序除了将请求搁置直到一个线程空闲之外别无选择。

让我们看看虚拟线程会发生什么:

image-20230827193533565
image-20230827193533565

正如我们所看到的,响应稳定在 1000 毫秒。虚拟线程在请求后立即创建和使用,因为从资源的角度来看它们非常便宜。在本例中,我们正在比较 spring 默认固定标准线程池(默认为 200)和 spring 默认无界虚拟线程池的使用情况。

**这种性能提升之所以可能,是因为场景过于简单,并且没有考虑 Spring Boot 应用程序可以执行的全部操作。**从底层操作系统基础设施中采用这种抽象可能是有好处的,但并非在所有情况下都是如此。

',12);function O(G,z){const s=p("ExternalLinkIcon");return c(),l("div",null,[k,v,g,n("p",null,[a("虚拟线程是Java 19 的"),n("a",m,[a("预览功能"),e(s)]),a(",这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。"),n("a",b,[a("Spring 6 版本"),e(s)]),a("最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。")]),h,_,n("p",null,[a("主要区别在于"),n("a",f,[a("虚拟线程"),e(s)]),a("在其操作周期中不依赖于操作系统线程:它们与硬件解耦,因此有了“虚拟”这个词。这种解耦是由 JVM 提供的抽象层实现的。")]),w,x,y,n("p",null,[a("从 Spring Framework 6(和 Spring Boot 3)开始,虚拟线程功能正式公开,但虚拟线程是Java 19 的"),n("a",T,[a("预览功能。"),e(s)]),a("这意味着我们需要告诉 JVM 我们要在应用程序中启用它们。由于我们使用 Maven 来构建应用程序,因此我们希望确保在 pom.xml 中包含以下"),j,a(":")]),E,n("p",null,[a("第一个 Spring Bean "),S,a("将取代标准的*"),n("a",C,[a("ApplicationTaskExecutor"),e(s)]),a("* ,提供为每个任务启动新虚拟线程的"),q,a("。第二个 bean,名为"),n("em",null,[a("ProtocolHandlerVirtualThreadExecutorCustomizer,"),P,n("a",V,[a("TomcatProtocolHandler 。"),e(s)]),B,n("a",I,[a("@ConditionalOnProperty,"),e(s)]),a("**以通过切换application.yaml")]),a("文件中配置属性的值来按需启用虚拟线程:")]),L,n("p",null,[a("*"),n("a",M,[a("Thread"),e(s)]),a("*对象的toString *()*方法将返回我们需要的所有信息:线程 ID、线程名称、线程组和优先级。让我们通过一个"),n("a",A,[J,e(s)]),a("请求来访问这个端点:")]),H,n("p",null,[a("对于此负载测试,我们将使用"),n("a",R,[a("JMeter"),e(s)]),a("。这不是虚拟线程和标准线程之间的完整性能比较,而是我们可以使用不同参数构建其他测试的起点。")]),N])}const W=o(d,[["render",O],["__file","在 Spring 6 中使用虚拟线程.html.vue"]]);export{W as default}; diff --git "a/assets/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html-UTI2zCNy.js" "b/assets/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html-UTI2zCNy.js" new file mode 100644 index 00000000..23e8e9ec --- /dev/null +++ "b/assets/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html-UTI2zCNy.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-0b5d4df0","path":"/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html","title":"基于kubernetes的分布式限流","lang":"zh-CN","frontmatter":{"description":"基于kubernetes的分布式限流 做为一个数据上报系统,随着接入量越来越大,由于 API 接口无法控制调用方的行为,因此当遇到瞬时请求量激增时,会导致接口占用过多服务器资源,使得其他请求响应速度降低或是超时,更有甚者可能导致服务器宕机。 一、概念 限流(Ratelimiting)指对应用服务的请求进行限制,例如某一接口的请求限制为 100 个每秒,对超过限制的请求则进行快速失败或丢弃。 1.1 使用场景 限流可以应对: 热点业务带来的突发请求; 调用方 bug 导致的突发请求; 恶意攻击请求。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"基于kubernetes的分布式限流"}],["meta",{"property":"og:description","content":"基于kubernetes的分布式限流 做为一个数据上报系统,随着接入量越来越大,由于 API 接口无法控制调用方的行为,因此当遇到瞬时请求量激增时,会导致接口占用过多服务器资源,使得其他请求响应速度降低或是超时,更有甚者可能导致服务器宕机。 一、概念 限流(Ratelimiting)指对应用服务的请求进行限制,例如某一接口的请求限制为 100 个每秒,对超过限制的请求则进行快速失败或丢弃。 1.1 使用场景 限流可以应对: 热点业务带来的突发请求; 调用方 bug 导致的突发请求; 恶意攻击请求。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:image","content":"http://www.wenzhihuai.com/"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T13:13:41.000Z"}],["meta",{"name":"twitter:card","content":"summary_large_image"}],["meta",{"name":"twitter:image:alt","content":"基于kubernetes的分布式限流"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T13:13:41.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"基于kubernetes的分布式限流\\",\\"image\\":[\\"http://www.wenzhihuai.com/\\"],\\"dateModified\\":\\"2024-01-25T13:13:41.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[{"level":2,"title":"一、概念","slug":"一、概念","link":"#一、概念","children":[{"level":3,"title":"1.1 使用场景","slug":"_1-1-使用场景","link":"#_1-1-使用场景","children":[]},{"level":3,"title":"1.2 维度","slug":"_1-2-维度","link":"#_1-2-维度","children":[]},{"level":3,"title":"1.3 分布式限流","slug":"_1-3-分布式限流","link":"#_1-3-分布式限流","children":[]}]},{"level":2,"title":"二、分布式限流常用方案","slug":"二、分布式限流常用方案","link":"#二、分布式限流常用方案","children":[]},{"level":2,"title":"三、基于kubernetes的分布式限流","slug":"三、基于kubernetes的分布式限流","link":"#三、基于kubernetes的分布式限流","children":[{"level":3,"title":"3.1 kubernetes中的副本数","slug":"_3-1-kubernetes中的副本数","link":"#_3-1-kubernetes中的副本数","children":[]},{"level":3,"title":"3.2 rateLimiter的创建","slug":"_3-2-ratelimiter的创建","link":"#_3-2-ratelimiter的创建","children":[]},{"level":3,"title":"3.3 rateLimiter的获取","slug":"_3-3-ratelimiter的获取","link":"#_3-3-ratelimiter的获取","children":[]},{"level":3,"title":"3.4 filter里的判断","slug":"_3-4-filter里的判断","link":"#_3-4-filter里的判断","children":[]}]},{"level":2,"title":"四、性能压测","slug":"四、性能压测","link":"#四、性能压测","children":[]},{"level":2,"title":"五、其他问题","slug":"五、其他问题","link":"#五、其他问题","children":[]},{"level":2,"title":"参考","slug":"参考","link":"#参考","children":[]}],"git":{"createdTime":1706066758000,"updatedTime":1706188421000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":7.15,"words":2145},"filePathRelative":"java/基于kubernetes的分布式限流.md","localizedDate":"2024年1月24日","excerpt":"

基于kubernetes的分布式限流

\\n

做为一个数据上报系统,随着接入量越来越大,由于 API 接口无法控制调用方的行为,因此当遇到瞬时请求量激增时,会导致接口占用过多服务器资源,使得其他请求响应速度降低或是超时,更有甚者可能导致服务器宕机。

\\n

一、概念

\\n

限流(Ratelimiting)指对应用服务的请求进行限制,例如某一接口的请求限制为 100 个每秒,对超过限制的请求则进行快速失败或丢弃。

\\n

1.1 使用场景

\\n

限流可以应对:

\\n
    \\n
  • 热点业务带来的突发请求;
  • \\n
  • 调用方 bug 导致的突发请求;
  • \\n
  • 恶意攻击请求。
  • \\n
","autoDesc":true}');export{e as data}; diff --git "a/assets/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html-tJsMLZCo.js" "b/assets/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html-tJsMLZCo.js" new file mode 100644 index 00000000..fb9103a6 --- /dev/null +++ "b/assets/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html-tJsMLZCo.js" @@ -0,0 +1,54 @@ +import{_ as t}from"./plugin-vue_export-helper-x3n3nnut.js";import{r as p,o as i,c as o,a as s,d as n,b as e,e as c}from"./app-hbwtiwmf.js";const l="/assets/1240-20240125210940819-6188218-cOcDzpSc.png",r="/assets/1240-20240125211018162-rl8tLiYu.png",u="/assets/1240-20240125211018144-_fS9AL1O.png",k="/assets/1240-20240125211018162-rl8tLiYu.png",d="/assets/1240-20240125211018163-lTuJ6Fsc.png",m={},v=c('

基于kubernetes的分布式限流

做为一个数据上报系统,随着接入量越来越大,由于 API 接口无法控制调用方的行为,因此当遇到瞬时请求量激增时,会导致接口占用过多服务器资源,使得其他请求响应速度降低或是超时,更有甚者可能导致服务器宕机。

一、概念

限流(Ratelimiting)指对应用服务的请求进行限制,例如某一接口的请求限制为 100 个每秒,对超过限制的请求则进行快速失败或丢弃。

1.1 使用场景

限流可以应对:

  • 热点业务带来的突发请求;
  • 调用方 bug 导致的突发请求;
  • 恶意攻击请求。

1.2 维度

对于限流场景,一般需要考虑两个维度的信息:
时间
限流基于某段时间范围或者某个时间点,也就是我们常说的“时间窗口”,比如对每分钟、每秒钟的时间窗口做限定
资源
基于可用资源的限制,比如设定最大访问次数,或最高可用连接数。
  限流就是在某个时间窗口对资源访问做限制,比如设定每秒最多100个访问请求。

image.png
image.png

1.3 分布式限流

分布式限流相比于单机限流,只是把限流频次分配到各个节点中,比如限制某个服务访问100qps,如果有10个节点,那么每个节点理论上能够平均被访问10次,如果超过了则进行频率限制。

二、分布式限流常用方案

基于Guava的客户端限流
Guava是一个客户端组件,在其多线程模块下提供了以RateLimiter为首的几个限流支持类。它只能对“当前”服务进行限流,即它不属于分布式限流的解决方案。

网关层限流
服务网关,作为整个分布式链路中的第一道关卡,承接了所有用户来访请求。我们在网关层进行限流,就可以达到了整体限流的目的了。目前,主流的网关层有以软件为代表的Nginx,还有Spring Cloud中的Gateway和Zuul这类网关层组件,也有以硬件为代表的F5。

中间件限流
将限流信息存储在分布式环境中某个中间件里(比如Redis缓存),每个组件都可以从这里获取到当前时刻的流量统计,从而决定是拒绝服务还是放行流量。

限流组件
目前也有一些开源组件提供了限流的功能,比如Sentinel就是一个不错的选择。Sentinel是阿里出品的开源组件,并且包含在了Spring Cloud Alibaba组件库中。Hystrix也具有限流的功能。

Guava的Ratelimiter设计实现相当不错,可惜只能支持单机,网关层限流如果是单机则不太满足高可用,并且分布式网关的话还是需要依赖中间件限流,而redis之类的网络通信需要占用一小部分的网络消耗。阿里的Sentinel也是同理,底层使用的是redis或者zookeeper,每次访问都需要调用一次redis或者zk的接口。那么在云原生场景下,我们有没有什么更好的办法呢?

对于极致追求高性能的服务不需要考虑熔断、降级来说,是需要尽量减少网络之间的IO,那么是否可以通过一个总限频然后分配到具体的单机里面去,在单机中实现平均的限流,比如限制某个ip的qps为100,服务总共有10个节点,那么平均到每个服务里就是10qps,此时就可以通过guava的ratelimiter来实现了,甚至说如果服务的节点动态调整,单个服务的qps也能动态调整。

三、基于kubernetes的分布式限流

在Spring Boot应用中,定义一个filter,获取请求参数里的key(ip、userId等),然后根据key来获取rateLimiter,其中,rateLimiter的创建由数据库定义的限频数和副本数来判断,最后,再通过rateLimiter.tryAcquire来判断是否可以通过。

企业微信截图_868136b4-f9e2-4813-bc02-281a66756ecd.png
企业微信截图_868136b4-f9e2-4813-bc02-281a66756ecd.png

3.1 kubernetes中的副本数

在实际的服务中,数据上报服务一般无法确定客户端的上报时间、上报量,特别是对于这种要求高性能,服务一般都会用到HPA来实现动态扩缩容,所以,需要去间隔一段时间去获取服务的副本数。

func CountDeploymentSize(namespace string, deploymentName string) *int32 {
+	deployment, err := client.AppsV1().Deployments(namespace).Get(context.TODO(), deploymentName, metav1.GetOptions{})
+	if err != nil {
+		return nil
+	}
+	return deployment.Spec.Replicas
+}
+

用法:GET host/namespaces/test/deployments/k8s-rest-api直接即可。

3.2 rateLimiter的创建

在RateLimiterService中定义一个LoadingCache<String, RateLimiter>,其中,key可以为ip、userId等,并且,在多线程的情况下,使用refreshAfterWrite只阻塞加载数据的线程,其他线程则返回旧数据,极致发挥缓存的作用。

private final LoadingCache<String, RateLimiter> loadingCache = Caffeine.newBuilder()
+        .maximumSize(10_000)
+        .refreshAfterWrite(20, TimeUnit.MINUTES)
+        .build(this::createRateLimit);
+//定义一个默认最小的QPS
+private static final Integer minQpsLimit = 3000;
+

之后是创建rateLimiter,获取总限频数totalLimit和副本数replicas,之后是自己所需的逻辑判断,可以根据totalLimit和replicas的情况来进行qps的限定。

public RateLimiter createRateLimit(String key) {
+    log.info("createRateLimit,key:{}", key);
+    int totalLimit = 获取总限频数,可以在数据库中定义
+    Integer replicas = kubernetesService.getDeploymentReplicas();
+    RateLimiter rateLimiter;
+    if (totalLimit > 0 && replicas == null) {
+        rateLimiter = RateLimiter.create(totalLimit);
+    } else if (totalLimit > 0) {
+        int nodeQpsLimit = totalLimit / replicas;
+        rateLimiter = RateLimiter.create(nodeQpsLimit > minQpsLimit ? nodeQpsLimit : minQpsLimit);
+    } else {
+        rateLimiter = RateLimiter.create(minQpsLimit);
+    }
+    log.info("create rateLimiter success,key:{},rateLimiter:{}", key, rateLimiter);
+    return rateLimiter;
+}
+

3.3 rateLimiter的获取

根据key获取RateLimiter,如果有特殊需求的话,需要判断key不存在的尝尽

public RateLimiter getRateLimiter(String key) {
+  return loadingCache.get(key);
+}
+

3.4 filter里的判断

最后一步,就是使用rateLimiter来进行限流,如果rateLimiter.tryAcquire()为true,则进行filterChain.doFilter(request, response),如果为false,则返回HttpStatus.TOO_MANY_REQUESTS

public class RateLimiterFilter implements Filter {
+    @Resource
+    private RateLimiterService rateLimiterService;
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+        String key = httpServletRequest.getHeader("key");
+        RateLimiter rateLimiter = rateLimiterService.getRateLimiter(key);
+        if (rateLimiter != null) {
+            if (rateLimiter.tryAcquire()) {
+                filterChain.doFilter(request, response);
+            } else {
+                httpServletResponse.setStatus(HttpStatus.TOO_MANY_REQUESTS.value());
+            }
+        } else {
+            filterChain.doFilter(request, response);
+        }
+    }
+}
+

四、性能压测

为了方便对比性能之间的差距,我们在本地单机做了下列测试,其中,总限频都设置为3万。

无限流

企业微信截图_ea1b7815-3b89-43bf-aed7-240e135bdad1.png
企业微信截图_ea1b7815-3b89-43bf-aed7-240e135bdad1.png

使用redis限流

其中,ping redis大概6-7ms左右,对应的,每次请求需要访问redis,时延都有大概6-7ms,性能下降明显

企业微信截图_9118c4e0-c7f3-4e74-9649-4cd4d56fda79.png
企业微信截图_9118c4e0-c7f3-4e74-9649-4cd4d56fda79.png

自研限流

性能几乎追平无限流的场景,guava的rateLimiter确实表现卓越

企业微信截图_9f6510bd-be9e-438b-aa9d-bdd13ebca953.png
企业微信截图_9f6510bd-be9e-438b-aa9d-bdd13ebca953.png

五、其他问题

5.1 对于保证qps限频准确的时候,应该怎么解决呢?

在k8s中,服务是动态扩缩容的,相应的,每个节点应该都要有所变化,如果对外宣称限频100qps,而且后续业务方真的要求百分百准确,只能把LoadingCache<String, RateLimiter>的过期时间调小一点,让它能够近实时的更新单节点的qps。这里还需要考虑一下k8s的压力,因为每次都要获取副本数,这里也是需要做缓存的

5.2 服务从1个节点动态扩为4个节点,这个时候新节点识别为4,但其实有些并没有启动完,会不会造成某个节点承受了太大的压力

理论上是存在这个可能的,这个时候需要考虑一下初始的副本数的,扩缩容不能一蹴而就,一下子从1变为4变为几十个这种。一般的话,生产环境肯定是不能只有一个节点,并且要考虑扩缩容的话,至于要有多个副本预备的

5.3 如果有多个副本,怎么保证请求是均匀的

这个是依赖于k8s的service负载均衡策略的,这个我们之前做过实验,流量确实是能够均匀的落到节点上的。还有就是,我们整个限流都是基于k8s的,如果k8s出现问题,那就是整个集群所有服务都有可能出现问题了。

参考

',55),b={href:"https://blog.csdn.net/hou_ge/article/details/113869419",target:"_blank",rel:"noopener noreferrer"},g=s("br",null,null,-1),h={href:"https://www.infoq.cn/article/qg2tx8fyw5vt-f3hh673",target:"_blank",rel:"noopener noreferrer"},f=s("br",null,null,-1),_={href:"https://www.cnblogs.com/huilei/p/13773557.html",target:"_blank",rel:"noopener noreferrer"};function L(y,w){const a=p("ExternalLinkIcon");return i(),o("div",null,[v,s("p",null,[n("1."),s("a",b,[n("常见的分布式限流解决方案"),e(a)]),g,n(" 2."),s("a",h,[n("分布式服务限流实战"),e(a)]),f,n(" 3."),s("a",_,[n("高性能"),e(a)])])])}const x=t(m,[["render",L],["__file","基于kubernetes的分布式限流.html.vue"]]);export{x as default}; diff --git "a/assets/\346\211\247\350\241\214\350\256\241\345\210\222explain.html-DEhFzLaN.js" "b/assets/\346\211\247\350\241\214\350\256\241\345\210\222explain.html-DEhFzLaN.js" new file mode 100644 index 00000000..28b3ac09 --- /dev/null +++ "b/assets/\346\211\247\350\241\214\350\256\241\345\210\222explain.html-DEhFzLaN.js" @@ -0,0 +1 @@ +import{_ as a}from"./plugin-vue_export-helper-x3n3nnut.js";import{o as t,c as n,a as e,d as o}from"./app-hbwtiwmf.js";const _={},c=e("h1",{id:"执行计划explain",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#执行计划explain","aria-hidden":"true"},"#"),o(" 执行计划explain")],-1),r=e("p",null,"第一次听到执行计划还是挺懵的,感觉像是存储函数什么样的东西,后来发现,居然是explain",-1),s=[c,r];function i(l,d){return t(),n("div",null,s)}const x=a(_,[["render",i],["__file","执行计划explain.html.vue"]]);export{x as default}; diff --git "a/assets/\346\211\247\350\241\214\350\256\241\345\210\222explain.html-v0f75n9M.js" "b/assets/\346\211\247\350\241\214\350\256\241\345\210\222explain.html-v0f75n9M.js" new file mode 100644 index 00000000..bdd3ce33 --- /dev/null +++ "b/assets/\346\211\247\350\241\214\350\256\241\345\210\222explain.html-v0f75n9M.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-2675bfdc","path":"/database/mysql/%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92explain.html","title":"执行计划explain","lang":"zh-CN","frontmatter":{"description":"执行计划explain 第一次听到执行计划还是挺懵的,感觉像是存储函数什么样的东西,后来发现,居然是explain","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/mysql/%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92explain.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"执行计划explain"}],["meta",{"property":"og:description","content":"执行计划explain 第一次听到执行计划还是挺懵的,感觉像是存储函数什么样的东西,后来发现,居然是explain"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"执行计划explain\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.14,"words":41},"filePathRelative":"database/mysql/执行计划explain.md","localizedDate":"2024年1月24日","excerpt":"

执行计划explain

\\n

第一次听到执行计划还是挺懵的,感觉像是存储函数什么样的东西,后来发现,居然是explain

\\n","autoDesc":true}');export{e as data}; diff --git "a/assets/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html-D5OE_lZE.js" "b/assets/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html-D5OE_lZE.js" new file mode 100644 index 00000000..479c4151 --- /dev/null +++ "b/assets/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html-D5OE_lZE.js" @@ -0,0 +1 @@ +const e=JSON.parse('{"key":"v-0a0b7a54","path":"/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html","title":"数据库缓存","lang":"zh-CN","frontmatter":{"description":"数据库缓存 在MySQL 5.6开始,就已经默认禁用查询缓存了。在MySQL 8.0,就已经删除查询缓存功能了。 将select语句和语句的结果做hash映射关系后保存在一定的内存区域内。 禁用原因: 1.命中率低 2.写时所有都失效 禁用了:https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg。","head":[["meta",{"property":"og:url","content":"http://www.wenzhihuai.com/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html"}],["meta",{"property":"og:site_name","content":"个人博客"}],["meta",{"property":"og:title","content":"数据库缓存"}],["meta",{"property":"og:description","content":"数据库缓存 在MySQL 5.6开始,就已经默认禁用查询缓存了。在MySQL 8.0,就已经删除查询缓存功能了。 将select语句和语句的结果做hash映射关系后保存在一定的内存区域内。 禁用原因: 1.命中率低 2.写时所有都失效 禁用了:https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-01-25T11:42:16.000Z"}],["meta",{"property":"article:author","content":"Zephery"}],["meta",{"property":"article:modified_time","content":"2024-01-25T11:42:16.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"数据库缓存\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-01-25T11:42:16.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"Zephery\\",\\"url\\":\\"https://wenzhihuai.com/article/\\"}]}"]]},"headers":[],"git":{"createdTime":1706092222000,"updatedTime":1706182936000,"contributors":[{"name":"zhihuaiwen","email":"zhihuaiwen@tencent.com","commits":2}]},"readingTime":{"minutes":0.34,"words":101},"filePathRelative":"database/mysql/数据库缓存.md","localizedDate":"2024年1月24日","excerpt":"

数据库缓存

\\n

在MySQL 5.6开始,就已经默认禁用查询缓存了。在MySQL 8.0,就已经删除查询缓存功能了。

\\n

将select语句和语句的结果做hash映射关系后保存在一定的内存区域内。

\\n

禁用原因:

\\n

1.命中率低

\\n

2.写时所有都失效

\\n

禁用了:https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg。

","autoDesc":true}');export{e as data}; diff --git "a/assets/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html-ELi5zypK.js" "b/assets/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html-ELi5zypK.js" new file mode 100644 index 00000000..6ea28115 --- /dev/null +++ "b/assets/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html-ELi5zypK.js" @@ -0,0 +1 @@ +import{_ as s}from"./plugin-vue_export-helper-x3n3nnut.js";import{r,o as a,c,a as e,d as t,b as o}from"./app-hbwtiwmf.js";const l={},_=e("h1",{id:"数据库缓存",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#数据库缓存","aria-hidden":"true"},"#"),t(" 数据库缓存")],-1),d=e("p",null,"在MySQL 5.6开始,就已经默认禁用查询缓存了。在MySQL 8.0,就已经删除查询缓存功能了。",-1),i={href:"https://so.csdn.net/so/search?q=hash&spm=1001.2101.3001.7020",target:"_blank",rel:"noopener noreferrer"},h=e("p",null,"禁用原因:",-1),p=e("p",null,"1.命中率低",-1),m=e("p",null,"2.写时所有都失效",-1),f={href:"https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg%E3%80%82",target:"_blank",rel:"noopener noreferrer"},u={href:"https://blog.csdn.net/zzddada/article/details/124116182",target:"_blank",rel:"noopener noreferrer"};function x(g,b){const n=r("ExternalLinkIcon");return a(),c("div",null,[_,d,e("p",null,[t("将select语句和语句的结果做"),e("a",i,[t("hash"),o(n)]),t("映射关系后保存在一定的内存区域内。")]),h,p,m,e("p",null,[t("禁用了:"),e("a",f,[t("https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg。"),o(n)])]),e("p",null,[t("查询缓存讲解:"),e("a",u,[t("https://blog.csdn.net/zzddada/article/details/124116182"),o(n)])])])}const E=s(l,[["render",x],["__file","数据库缓存.html.vue"]]);export{E as default}; diff --git a/bigdata/index.html b/bigdata/index.html new file mode 100644 index 00000000..e68ed829 --- /dev/null +++ b/bigdata/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/bigdata/spark/elastic-spark.html b/bigdata/spark/elastic-spark.html new file mode 100644 index 00000000..276d4775 --- /dev/null +++ b/bigdata/spark/elastic-spark.html @@ -0,0 +1,76 @@ + + + + + + + + + + elastic spark | 个人博客 + + + + + +
跳至主要內容

elastic spark

Zephery约 514 字大约 2 分钟

elastic spark

Hadoop允许Elasticsearch在Spark中以两种方式使用:通过自2.1以来的原生RDD支持,或者通过自2.0以来的Map/Reduce桥接器。从5.0版本开始,elasticsearch-hadoop就支持Spark 2.0。目前spark支持的数据源有:
(1)文件系统:LocalFS、HDFS、Hive、text、parquet、orc、json、csv
(2)数据RDBMS:mysql、oracle、mssql
(3)NOSQL数据库:HBase、ES、Redis
(4)消息对象:Redis

elasticsearch相对hdfs来说,容易搭建、并且有可视化kibana支持,非常方便spark的初学入门,本文主要讲解用elasticsearch-spark的入门。

Spark - Apache Spark
Spark - Apache Spark

一、原生RDD支持

1.1 基础配置

相关库引入:

        <dependency>
+            <groupId>org.elasticsearch</groupId>
+            <artifactId>elasticsearch-spark-30_2.13</artifactId>
+            <version>8.1.3</version>
+        </dependency>
+

SparkConf配置,更多详细的请点击这里open in new window或者源码ConfigurationOptionsopen in new window

public static SparkConf getSparkConf() {
+    SparkConf sparkConf = new SparkConf().setAppName("elasticsearch-spark-demo");
+    sparkConf.set("es.nodes", "host")
+            .set("es.port", "xxxxxx")
+            .set("es.nodes.wan.only", "true")
+            .set("es.net.http.auth.user", "elxxxxastic")
+            .set("es.net.http.auth.pass", "xxxx")
+            .setMaster("local[*]");
+    return sparkConf;
+}
+

1.2 读取es数据

这里用的是kibana提供的sample data里面的索引kibana_sample_data_ecommerce,也可以替换成自己的索引。

public static void main(String[] args) {
+    SparkConf conf = getSparkConf();
+    try (JavaSparkContext jsc = new JavaSparkContext(conf)) {
+
+        JavaPairRDD<String, Map<String, Object>> esRDD =
+                JavaEsSpark.esRDD(jsc, "kibana_sample_data_ecommerce");
+        esRDD.collect().forEach(System.out::println);
+    }
+}
+

esRDD同时也支持query语句esRDD(final JavaSparkContext jsc, final String resource, final String query),一般对es的查询都需要根据时间筛选一下,不过相对于es的官方sdk,并没有那么友好的api,只能直接使用原生的dsl语句。

1.3 写数据

支持序列化对象、json,并且能够使用占位符动态索引写入数据(使用较少),不过多介绍了。

public static void jsonWrite(){
+    String json1 = "{\"reason\" : \"business\",\"airport\" : \"SFO\"}";
+    String json2 = "{\"participants\" : 5,\"airport\" : \"OTP\"}";
+    JavaRDD<String> stringRDD = jsc.parallelize(ImmutableList.of(json1, json2));
+    JavaEsSpark.saveJsonToEs(stringRDD, "spark-json");
+}
+

比较常用的读写也就这些,更多可以看下官网相关介绍。

二、Spark Streaming

spark的实时处理,es5.0的时候开始支持,目前

三、Spark SQL

四、Spark Structure Streaming

五、Spark on kubernetes Operator

参考:

1.Apache Spark supportopen in new window

2.elasticsearch-hadoopopen in new window

3.使用SparkSQL操作Elasticsearch - Spark入门教程open in new window

+ + + diff --git a/bigdata/spark/index.html b/bigdata/spark/index.html new file mode 100644 index 00000000..ab113b74 --- /dev/null +++ b/bigdata/spark/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/category/index.html b/category/index.html new file mode 100644 index 00000000..f893710b --- /dev/null +++ b/category/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 分类 | 个人博客 + + + + + + + + + diff --git a/cloudnative/index.html b/cloudnative/index.html new file mode 100644 index 00000000..767d33fe --- /dev/null +++ b/cloudnative/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git "a/database/elasticsearch/elasticsearch\346\272\220\347\240\201debug.html" "b/database/elasticsearch/elasticsearch\346\272\220\347\240\201debug.html" new file mode 100644 index 00000000..9ac7166a --- /dev/null +++ "b/database/elasticsearch/elasticsearch\346\272\220\347\240\201debug.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 【elasticsearch】源码debug | 个人博客 + + + + + +
跳至主要內容

【elasticsearch】源码debug

Zephery约 151 字小于 1 分钟

【elasticsearch】源码debug

一、下载源代码

直接用idea下载代码https://github.com/elastic/elasticsearch.gitopen in new window
image

切换到特定版本的分支:比如7.17,之后idea会自己加上Run/Debug Elasitcsearch的,配置可以不用改,默认就好
image

二、修改设置(可选)

为了方便, 在 gradle/run.gradle 中关闭 Auth 认证:

setting 'xpack.security.enabled', 'false'

或者使用其中的用户名密码:

user username: 'elastic-admin', password: 'elastic-password', role: 'superuser'

三、启动

先启动上面的 remote debug, 然后用 gradlew 启动项目:

./gradlew :run --debug-jvm
打开浏览器http://localhost:9200即可看到es相关信息了
image

+ + + diff --git a/database/elasticsearch/index.html b/database/elasticsearch/index.html new file mode 100644 index 00000000..e88a885f --- /dev/null +++ b/database/elasticsearch/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git "a/database/elasticsearch/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html" "b/database/elasticsearch/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html" new file mode 100644 index 00000000..fa2b90e6 --- /dev/null +++ "b/database/elasticsearch/\343\200\220elasticsearch\343\200\221\346\220\234\347\264\242\350\277\207\347\250\213\350\257\246\350\247\243.html" @@ -0,0 +1,345 @@ + + + + + + + + + + 【elasticsearch】搜索过程详解 | 个人博客 + + + + + +
跳至主要內容

【elasticsearch】搜索过程详解

Zephery约 2650 字大约 9 分钟

【elasticsearch】搜索过程详解

本文基于elasticsearch8.1。在es搜索中,经常会使用索引+星号,采用时间戳来进行搜索,比如aaaa-*在es中是怎么处理这类请求的呢?是对匹配的进行搜索呢还是仅仅根据时间找出索引,然后才遍历索引进行搜索。在了解其原理前先了解一些基本知识。

SearchType

QUERY_THEN_FETCH(默认):第一步,先向所有的shard发出请求,各分片只返回排序和排名相关的信息(注意,不包括文档document),然后按照各分片返回的分数进行重新排序和排名,取前size个文档。然后进行第二步,去相关的shard取document。这种方式返回的document与用户要求的size是相等的。
DFS_QUERY_THEN_FETCH:比第1种方式多了一个初始化散发(initial scatter)步骤。

为了能够深刻了解es的搜索过程,首先创建3个索引,每个索引指定一天的一条记录。

POST aaaa-16/_doc
+{
+  "@timestamp": "2022-02-16T16:21:15.000Z",
+  "word":"16"
+}
+
+
+POST aaaa-17/_doc
+{
+  "@timestamp": "2022-02-17T16:21:15.000Z",
+  "word":"17"
+}
+
+POST aaaa-18/_doc
+{
+  "@timestamp": "2022-02-18T16:21:15.000Z",
+  "word":"18"
+}
+

即可在kibana上看到3条数据

image-20220219195141327
image-20220219195141327

此时,假设我们用一个索引+星号来搜索,es内部的搜索是怎么样的呢?

GET aaaa*/_search
+{
+  "query": {
+    "range": {
+      "@timestamp": {
+        "gte": "2022-02-18T10:21:15.000Z",
+        "lte": "2022-02-18T17:21:15.000Z"
+      }
+    }
+  }
+}
+

正好命中一条记录返回。

{
+  "took" : 2,
+  "timed_out" : false,
+  "_shards" : {
+    "total" : 3,
+    "successful" : 3,
+    "skipped" : 0,
+    "failed" : 0
+  },
+  "hits" : {
+    "total" : {
+      "value" : 1,
+      "relation" : "eq"
+    },
+    "max_score" : 1.0,
+    "hits" : [
+      {
+        "_index" : "aaaa-18",
+        "_id" : "0zB2O38BoMIMP8QzHgdq",
+        "_score" : 1.0,
+        "_source" : {
+          "@timestamp" : "2022-02-18T16:21:15.000Z",
+          "word" : "18"
+        }
+      }
+    ]
+  }
+}
+
+

一、es的分布式搜索过程

一个搜索请求必须询问请求的索引中所有分片的某个副本来进行匹配。假设一个索引有5个主分片,每个主分片有1个副分片,共10个分片,一次搜索请求会由5个分片来共同完成,它们可能是主分片,也可能是副分片。也就是说,一次搜索请求只会命中所有分片副本中的一个。当搜索任务执行在分布式系统上时,整体流程如下图所示。图片来源Elasitcsearch源码解析与优化实战open in new window

2
2

搜索入口:

整个http请求的入口,主要使用的是Netty4HttpRequestHandler。

@ChannelHandler.Sharable
+class Netty4HttpRequestHandler extends SimpleChannelInboundHandler<HttpPipelinedRequest> {
+    @Override
+    protected void channelRead0(ChannelHandlerContext ctx, HttpPipelinedRequest httpRequest) {
+        final Netty4HttpChannel channel = ctx.channel().attr(Netty4HttpServerTransport.HTTP_CHANNEL_KEY).get();
+        boolean success = false;
+        try {
+            serverTransport.incomingRequest(httpRequest, channel);
+            success = true;
+        } finally {
+            if (success == false) {
+                httpRequest.release();
+            }
+        }
+    }
+}
+

二、初步调用流程

调用链路过程:Netty4HttpRequestHandler.channelRead0->AbstractHttpServerTransport.incomingRequest->AbstractHttpServerTransport.handleIncomingRequest->AbstractHttpServerTransport.dispatchRequest->RestController.dispatchRequest(实现了HttpServerTransport.Dispatcher)->SecurityRestFilter.handleRequest->BaseRestHandler.handleRequest->action.accept(channel)->RestCancellableNodeClient.doExecute->NodeClient.executeLocally->RequestFilterChain.proceed->TransportAction.proceed->TransportSearchAction.doExecute->TransportSearchAction.executeRequest(判断是本地执行还是远程执行)->TransportSearchAction.searchAsyncAction

协调节点的主要功能是接收请求,解析并构建目的的shard列表,然后异步发送到数据节点进行请求查询。具体就不细讲了,可按着debug的来慢慢调试。

特别注意下RestCancellableNodeClient.doExecute,从executeLocally执行所有的查询过程,并注册监听listener.onResponse(response),然后响应。

public <Request extends ActionRequest, Response extends ActionResponse> void doExecute(...) {
+  ...
+    TaskHolder taskHolder = new TaskHolder();
+    Task task = client.executeLocally(action, request, new ActionListener<>() {
+        @Override
+        public void onResponse(Response response) {
+            try {
+                closeListener.unregisterTask(taskHolder);
+            } finally {
+                listener.onResponse(response);
+            }
+        }
+    });
+  ...
+}
+

其次要注意的是:TransportSearchAction.searchAsyncAction才开始真正的搜索过程

private SearchPhase searchAsyncAction(...) {
+  ...
+    final QueryPhaseResultConsumer queryResultConsumer = searchPhaseController.newSearchPhaseResults();
+  AbstractSearchAsyncAction<? extends SearchPhaseResult> searchAsyncAction = switch (searchRequest.searchType()) {
+    case DFS_QUERY_THEN_FETCH -> new SearchDfsQueryThenFetchAsyncAction(...);
+    case QUERY_THEN_FETCH -> new SearchQueryThenFetchAsyncAction(...);
+  };
+  return searchAsyncAction;
+  ...
+}
+

之后就是执行AbstractSearchAsyncAction.start,启动AbstractSearchAsyncAction.executePhase的查询动作。

此处的SearchPhase实现类为SearchQueryThenFetchAsyncAction
+private void executePhase(SearchPhase phase) {
+    try {
+        phase.run();
+    } catch (Exception e) {
+        if (logger.isDebugEnabled()) {
+            logger.debug(new ParameterizedMessage("Failed to execute [{}] while moving to [{}] phase", request, phase.getName()), e);
+        }
+        onPhaseFailure(phase, "", e);
+    }
+}
+

三、协调节点

两阶段相应的实现位置:查询(Query)阶段—search.SearchQueryThenFetchAsyncAction;取回(Fetch)阶段—search.FetchSearchPhase。它们都继承自SearchPhase,如下图所示。

23
23

3.1 query阶段

图片来源官网open in new window,比较旧,但任然可用

12
12

(1)客户端发送一个search请求到node3,node3创建一个大小为from,to的优先级队列。
(2)node3转发转发search请求至索引的主分片或者副本,每个分片执行查询请求,并且将结果放到一个排序之后的from、to大小的优先级队列。
(3)每个分片把文档id和排序之后的值返回给协调节点node3,node3把结果合并然后创建一个全局排序之后的结果。

在RestSearchAction#prepareRequest方法中将请求体解析为SearchRequest 数据结构: 
+public RestChannelConsumer prepareRequest(.. .) {
+    SearchRequest searchRequest = new SearchRequest();
+    request.withContentOrSourceParamParserOrNull (parser ->
+        parseSearchRequest (searchRequest, request, parser, setSize));
+    ...
+}
+

3.1.1 构造目的shard列表

将请求涉及的本集群shard列表和远程集群的shard列表(远程集群用于跨集群访问)合并:

private void executeSearch(.. .) {
+  ...
+    final GroupShardsIterator<SearchShardIterator> shardIterators = mergeShardsIterators(localShardIterators, remoteShardIterators);
+    localShardIterators = StreamSupport.stream(localShardRoutings.spliterator(), false).map(it -> {
+    OriginalIndices finalIndices = finalIndicesMap.get(it.shardId().getIndex().getUUID());
+    assert finalIndices != null;
+    return new SearchShardIterator(searchRequest.getLocalClusterAlias(), it.shardId(), it.getShardRoutings(), finalIndices);
+    }).collect(Collectors.toList());
+	...
+}
+

查看结果

241
241

3.1.2 对所有分片进行搜索

AbstractSearchAsyncAction.run
+对每个分片进行搜索查询
+for (int i = 0; i < shardsIts.size(); i++) {
+    final SearchShardIterator shardRoutings = shardsIts.get(i);
+    assert shardRoutings.skip() == false;
+    assert shardIndexMap.containsKey(shardRoutings);
+    int shardIndex = shardIndexMap.get(shardRoutings);
+    performPhaseOnShard(shardIndex, shardRoutings, shardRoutings.nextOrNull());
+}
+

其中shardsIts是所有aaaa*的所有索引+其中一个副本

2141
2141

3.1.3 分片具体的搜索过程

AbstractSearchAsyncAction.performPhaseOnShard
+private void performPhaseOnShard(. ..) {
+    executePhaseOnShard(.. .) {
+        //收到执行成功的回复
+        public void inne rOnResponse (FirstResult result) {
+            maybeFork (thread, () -> onShardResult (result,shardIt) );
+        }
+        //收到执行失败的回复
+        public void onFailure (Exception t) {
+            maybeFork(thread, () -> onShardFailure (shardIndex, shard, shard. currentNodeId(),shardIt, t));
+        }
+    });
+}
+

分片结果,当前线程

//AbstractSearchAsyncAction.onShardResult
+...
+private void onShardResult (FirstResult result, SearchShardIterator shardIt) {
+    onShardSuccess(result);
+    success fulShardExecution(shardIt);
+}
+...
+//AbstractSearchAsyncAction.onShardResultConsumed
+private void successfulShardExecution (SearchShardIterator shardsIt) {
+    //计数器累加.
+    final int xTotalOps = totalOps.addAndGet (remainingOpsOnIterator);
+    //检查是否收到全部回复
+    if (xTotalOps == expectedTotalOps) {
+        onPhaseDone ();
+    } else if (xTota1Ops > expectedTotal0ps) {
+        throw new AssertionError(. ..);
+    }
+}
+
+
412
412

此处忽略了搜索结果totalHits为0的结果,并将结果进行累加,当xTotalOps等于expectedTotalOps时开始AbstractSearchAsyncAction.onPhaseDone再进行AbstractSearchAsyncAction.executeNextPhase取回阶段

3.2 Fetch阶段

取回阶段,图片来自官网open in new window

412412
412412

(1)各个shard 返回的只是各文档的id和排序值 IDs and sort values ,coordinate node根据这些id&sort values 构建完priority queue之后,然后把程序需要的document 的id发送mget请求去所有shard上获取对应的document

(2)各个shard将document返回给coordinate node

(3)coordinate node将合并后的document结果返回给client客户端

3.2.1 FetchSearchPhase(对应上面的1)

Query阶段的executeNextPhase方法触发Fetch阶段,Fetch阶段的起点为FetchSearchPhase#innerRun函数,从查询阶段的shard列表中遍历,跳过查询结果为空的shard,对特定目标shard执行executeFetch来获取数据,其中包括分页信息。对scroll请求的处理也在FetchSearchPhase#innerRun函数中。

private void innerRun() throws Exception {
+    final int numShards = context.getNumShards();
+    final boolean isScrollSearch = context.getRequest().scroll() != null;
+    final List<SearchPhaseResult> phaseResults = queryResults.asList();
+    final SearchPhaseController.ReducedQueryPhase reducedQueryPhase = resultConsumer.reduce();
+    final boolean queryAndFetchOptimization = queryResults.length() == 1;
+    final Runnable finishPhase = () -> moveToNextPhase(
+        searchPhaseController,
+        queryResults,
+        reducedQueryPhase,
+        queryAndFetchOptimization ? queryResults : fetchResults.getAtomicArray()
+    );
+            for (int i = 0; i < docIdsToLoad.length; i++) {
+                IntArrayList entry = docIdsToLoad[i];
+                SearchPhaseResult queryResult = queryResults.get(i);
+                if (entry == null) { 
+                    if (queryResult != null) {
+                        releaseIrrelevantSearchContext(queryResult.queryResult());
+                        progressListener.notifyFetchResult(i);
+                    }
+                    counter.countDown();
+                }else{
+                    executeFetch(
+                            queryResult.getShardIndex(),
+                            shardTarget,
+                            counter,
+                            fetchSearchRequest,
+                            queryResult.queryResult(),
+                            connection
+                        );
+                }
+        }
+    }
+}
+

再看源码:

启动一个线程来fetch
+AbstractSearchAsyncAction.executePhase->FetchSearchPhase.run->FetchSearchPhase.innerRun->FetchSearchPhase.executeFetch
+
+private void executeFetch(...) {
+    context.getSearchTransport()
+        .sendExecuteFetch(
+            connection,
+            fetchSearchRequest,
+            context.getTask(),
+            new SearchActionListener<FetchSearchResult>(shardTarget, shardIndex) {
+                @Override
+                public void innerOnResponse(FetchSearchResult result) {
+                  progressListener.notifyFetchResult(shardIndex);
+                  counter.onResult(result);
+                }
+
+                @Override
+                public void onFailure(Exception e) {
+                  progressListener.notifyFetchFailure(shardIndex, shardTarget, e);
+                  counter.onFailure(shardIndex, shardTarget, e);
+                }
+            }
+        );
+}
+  
+
13413
13413

counter是一个收集器CountedCollector,onResult(result)主要是每次收到的shard数据存放,并且执行一次countDown,当所有shard数据收集完之后,然后触发一次finishPhase。

# CountedCollector.class
+void countDown() {
+    assert counter.isCountedDown() == false : "more operations executed than specified";
+    if (counter.countDown()) {
+        onFinish.run();
+    }
+}
+

moveToNextPhase方法执行下一阶段,下-阶段要执行的任务定义在FetchSearchPhase构造 函数中,主要是触发ExpandSearchPhase。

3.2.2 ExpandSearchPhase(对应上图的2)

AbstractSearchAsyncAction.executePhase->ExpandSearchPhase.run。取回阶段完成之后执行ExpandSearchPhase#run,主要判断是否启用字段折叠,根据需要实现字段折叠功能,如果没有实现字段折叠,则直接返回给客户端。

image-20220317000858513
image-20220317000858513

ExpandSearchPhase执行完之后回复客户端,在AbstractSearchAsyncAction.sendSearchResponse方法中实现:

412412
412412

四、数据节点

4.1 执行query、fetch流程

执行本流程的线程池: search。

对各种Query请求的处理入口注册于SearchTransportService.registerRequestHandler。

public static void registerRequestHandler(TransportService transportService, SearchService searchService) {
+  ...
+  transportService.registerRequestHandler(
+    QUERY_ACTION_NAME,
+    ThreadPool.Names.SAME,
+    ShardSearchRequest::new,
+    (request, channel, task) -> searchService.executeQueryPhase(
+      request,
+      (SearchShardTask) task,
+      new ChannelActionListener<>(channel, QUERY_ACTION_NAME, request)
+    )
+  );
+  ...
+}
+

4.1.1 执行query请求

# SearchService
+public void executeQueryPhase(ShardSearchRequest request, SearchShardTask task, ActionListener<SearchPhaseResult> listener) {
+    assert request.canReturnNullResponseIfMatchNoDocs() == false || request.numberOfShards() > 1
+        : "empty responses require more than one shard";
+    final IndexShard shard = getShard(request);
+    rewriteAndFetchShardRequest(shard, request, listener.delegateFailure((l, orig) -> {
+        ensureAfterSeqNoRefreshed(shard, orig, () -> executeQueryPhase(orig, task), l);
+    }));
+}
+

其中ensureAfterSeqNoRefreshed是把request任务放到一个名为search的线程池里面执行,容量大小为1000。

1
1

主要是用来执行SearchService.executeQueryPhase->SearchService.loadOrExecuteQueryPhase->QueryPhase.execute。核心的查询封装在queryPhase.execute(context)中,其中调用Lucene实现检索,同时实现聚合:

public void execute (SearchContext searchContext) {
+    aggregationPhase.preProcess (searchContext);
+    boolean rescore = execute ( searchContext, searchContext.searcher(), searcher::setCheckCancelled, indexSort);
+    if (rescore) {
+        rescorePhase.execute (searchContext);
+        suggestPhase.execute (searchContext);
+        aggregationPhase.execute (searchContext);
+    }
+}
+

其中包含几个核心功能:

  • execute(),调用Lucene、searcher.search()实现搜索
  • rescorePhase,全文检索且需要打分
  • suggestPhase,自动补全及纠错
  • aggregationPhase,实现聚合

4.1.2 fetch流程

对各种Fetch请求的处理入口注册于SearchTransportService.registerRequestHandler。

transportService.registerRequestHandler(
+    QUERY_FETCH_SCROLL_ACTION_NAME,
+    ThreadPool.Names.SAME,
+    InternalScrollSearchRequest::new,
+    (request, channel, task) -> {
+        searchService.executeFetchPhase(
+            request,
+            (SearchShardTask) task,
+            new ChannelActionListener<>(channel, QUERY_FETCH_SCROLL_ACTION_NAME, request)
+        );
+    }
+);
+

对Fetch响应的实现封装在SearchService.executeFetchPhase中,核心是调用fetchPhase.execute(context)。按照命中的doc取得相关数据,填充到SearchHits中,最终封装到FetchSearchResult中。

# FetchPhase
+public void execute(SearchContext context) {
+    Profiler profiler = context.getProfilers() == null ? Profiler.NOOP : context.getProfilers().startProfilingFetchPhase();
+    SearchHits hits = null;
+    try {
+      //lucene构建搜索的结果
+        hits = buildSearchHits(context, profiler);
+    } finally {
+        ProfileResult profileResult = profiler.finish();
+        // Only set the shardResults if building search hits was successful
+        if (hits != null) {
+            context.fetchResult().shardResult(hits, profileResult);
+        }
+    }
+}
+

五、数据返回

入口:RestCancellableNodeClient.doExecute
Task task = client.executeLocally主要执行查询,并使用了ActionListener来进行监听
image-20220319003638991

其中onResponse的调用链路如下:RestActionListener.onResponse->RestResponseListener.processResponse->RestController.sendResponse->DefaultRestChannel.sendResponse->Netty4HttpChannel.sendResponse

public void sendResponse(RestResponse restResponse) {
+  ...
+   httpChannel.sendResponse(httpResponse, listener);
+  ...
+}
+
+

最后由Netty4HttpChannel.sendResponse来响应请求。

六、总结

当我们以aaaa*这样来搜索的时候,实际上查询了所有匹配以aaaa开头的索引,并且对所有的索引的分片都进行了一次Query,再然后对有结果的分片进行一次fetch,最终才能展示结果。可能觉得好奇,对所有分片都进行一次搜索,遍历分片所有的Lucene分段,会不会太过于消耗资源,因此合并Lucene分段对搜索性能有好处,这里下篇文章在讲吧。同时,聚合是发生在fetch过程中的,并不是lucene。

本文参考

  1. Elasitcsearch源码解析与优化实战open in new window
  2. Elasticsearch源码分析-搜索分析(一)open in new window
  3. Elasticsearch源码分析-搜索分析(二)open in new window
  4. Elasticsearch源码分析-搜索分析(三)open in new window
  5. Elasticsearch 通信模块的分析open in new window
  6. Elasticsearch 网络通信线程分析open in new window
+ + + diff --git a/database/index.html b/database/index.html new file mode 100644 index 00000000..e28ee37f --- /dev/null +++ b/database/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/database/mysql/1mysql.html b/database/mysql/1mysql.html new file mode 100644 index 00000000..4bed093b --- /dev/null +++ b/database/mysql/1mysql.html @@ -0,0 +1,46 @@ + + + + + + + + + + mysql | 个人博客 + + + + + + + + + diff --git "a/database/mysql/gap\351\224\201.html" "b/database/mysql/gap\351\224\201.html" new file mode 100644 index 00000000..42918613 --- /dev/null +++ "b/database/mysql/gap\351\224\201.html" @@ -0,0 +1,46 @@ + + + + + + + + + + gap锁 | 个人博客 + + + + + + + + + diff --git a/database/mysql/index.html b/database/mysql/index.html new file mode 100644 index 00000000..7c0eeb39 --- /dev/null +++ b/database/mysql/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git "a/database/mysql/\346\211\247\350\241\214\350\256\241\345\210\222explain.html" "b/database/mysql/\346\211\247\350\241\214\350\256\241\345\210\222explain.html" new file mode 100644 index 00000000..43abfe3b --- /dev/null +++ "b/database/mysql/\346\211\247\350\241\214\350\256\241\345\210\222explain.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 执行计划explain | 个人博客 + + + + + + + + + diff --git "a/database/mysql/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html" "b/database/mysql/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html" new file mode 100644 index 00000000..3e113e65 --- /dev/null +++ "b/database/mysql/\346\225\260\346\215\256\345\272\223\347\274\223\345\255\230.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 数据库缓存 | 个人博客 + + + + + +
跳至主要內容

数据库缓存

Zephery约 101 字小于 1 分钟

数据库缓存

在MySQL 5.6开始,就已经默认禁用查询缓存了。在MySQL 8.0,就已经删除查询缓存功能了。

将select语句和语句的结果做hashopen in new window映射关系后保存在一定的内存区域内。

禁用原因:

1.命中率低

2.写时所有都失效

禁用了:https://mp.weixin.qq.com/s/_EXXmciNdgXswSVzKyO4xg。open in new window

查询缓存讲解:https://blog.csdn.net/zzddada/article/details/124116182open in new window

+ + + diff --git a/devops/devops-ping-tai.html b/devops/devops-ping-tai.html new file mode 100644 index 00000000..d0f9299a --- /dev/null +++ b/devops/devops-ping-tai.html @@ -0,0 +1,291 @@ + + + + + + + + + + 3.1 DevOps平台.md | 个人博客 + + + + + +
跳至主要內容

3.1 DevOps平台.md

Zephery约 3580 字大约 12 分钟

3.1 DevOps平台.mdopen in new window

DevOps定义(来自维基百科): DevOps(Development和Operations的组合词)是一种重视“软件开发人员(Dev)”和“IT运维技术人员(Ops)”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程,来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。

公司技术部目前几百人左右吧,但是整个技术栈还是比较落后的,尤其是DevOps、容器这一块,需要将全线打通,当时进来也主要是负责DevOps这一块的工作,应该说也是没怎么做好,其中也走了不少弯路,下面主要是自己踩过的坑吧。

一、自由风格的软件项目

主要还是基于jenkins里面构建一个自由风格的软件项目,当时参考的是阿里的codepipeline,就是对jenkins封装一层,包括创建job、立即构建、获取构建进度等都进行封装,并将需要的东西进行存库,没有想到码代码的时候,一堆的坑,比如: 1.连续点击立即构建,jenkins是不按顺序返回的,(分布式锁解决) 2.跨域调用,csrf,这个还好,不过容易把jenkins搞的无法登录(注意配置,具体可以点击这里open in new window) 3.创建job的时候只支持xml格式,还要转换一下,超级坑(xstream强行转换) 4.docker构建的时候,需要挂载宿主机的docker(想过用远程的,但效率不高) 5.数据库与jenkins的job一致性问题,任务创建失败,批量删除太慢(目前没想好怎么解决) 6.由于使用了数据库,需要检测job是否构建完成,为了自定义参数,我们自写了个通知插件,将构建状态返回到kafka,然后管理平台在进行消息处理。

完成了以上的东西,不过由于太过于简单,导致只能进行单条线的CICD,而且CI仅仅实现了打包,没有将CD的过程一同串行起来。简单来说就是,用户点击了构建只是能够打出一个镜像,但是如果要部署到kubernetes,还是需要在应用里手动更换一下镜像版本。总体而言,这个版本的jenkins我们使用的还是单点的,不足以支撑构建量比较大的情况,甚至如果当前服务挂了,断网了,整一块的构建功能都不能用。

<project>
+    <actions/>
+    <description>xxx</description>
+    <properties>
+        <hudson.model.ParametersDefinitionProperty>
+            <parameterDefinitions>
+                <hudson.model.TextParameterDefinition>
+                    <name>buildParam</name>
+                    <defaultValue>v1</defaultValue>
+                </hudson.model.TextParameterDefinition>
+                <hudson.model.TextParameterDefinition>
+                    <name>codeBranch</name>
+                    <defaultValue>master</defaultValue>
+                </hudson.model.TextParameterDefinition>
+            </parameterDefinitions>
+        </hudson.model.ParametersDefinitionProperty>
+    </properties>
+    <scm class="hudson.plugins.git.GitSCM">
+        <configVersion>2</configVersion>
+        <userRemoteConfigs>
+            <hudson.plugins.git.UserRemoteConfig>
+                <url>http://xxxxx.git</url>
+                <credentialsId>002367566a4eb4bb016a4eb723550054</credentialsId>
+            </hudson.plugins.git.UserRemoteConfig>
+        </userRemoteConfigs>
+        <branches>
+            <hudson.plugins.git.BranchSpec>
+                <name>${codeBranch}</name>
+            </hudson.plugins.git.BranchSpec>
+        </branches>
+        <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
+        <extensions/>
+    </scm>
+    <builders>
+        <hudson.tasks.Shell>
+            <command>ls</command>
+        </hudson.tasks.Shell>
+        <hudson.tasks.Maven>
+            <targets>clean package install -Dmaven.test.skip=true</targets>
+            <mavenName>mvn3.5.4</mavenName>
+        </hudson.tasks.Maven>
+        <com.cloudbees.dockerpublish.DockerBuilder>
+            <server>
+                <uri>unix:///var/run/docker.sock</uri>
+            </server>
+            <registry>
+                <url>http://xxxx</url>
+            </registry>
+            <repoName>xxx/xx</repoName>
+            <forcePull>true</forcePull>
+            <dockerfilePath>Dockerfile</dockerfilePath>
+            <repoTag>${buildParam}</repoTag>
+            <skipTagLatest>true</skipTagLatest>
+        </com.cloudbees.dockerpublish.DockerBuilder>
+    </builders>
+    <publishers>
+        <com.xxxx.notifications.Notifier/>
+    </publishers>
+</project>
+

二、优化之后的CICD

上面的过程也仍然没有没住DevOps的流程,人工干预的东西依旧很多,由于上级急需产出,所以只能将就着继续下去。我们将构建、部署每个当做一个小块,一个CICD的过程可以选择构建、部署,花了很大的精力,完成了串行化的别样的CICD。 以下图为例,整个流程的底层为:paas平台-jenkins-kakfa-管理平台(选择cicd的下一步)-kafka-cicd组件调用管理平台触发构建-jenkins-kafka-管理平台(选择cicd的下一步)-kafka-cicd组件调用管理平台触发部署。

目前实现了串行化的CICD构建部署,之后考虑实现多个CICD并行,并且一个CICD能够调用另一个CICD,实际运行中,出现了一大堆问题。由于经过的组件太多,一次cicd的运行报错,却很难排查到问题出现的原因,业务方的投诉也开始慢慢多了起来,只能说劝导他们不要用这个功能。

没有CICD,就无法帮助公司上容器云,无法合理的利用容器云的特性,更无法走上云原生的道路。于是,我们决定另谋出路。

三、调研期

由于之前的CICD问题太多,特别是经过的组件太多了,导致出现问题的时候无法正常排查,为了能够更加稳定可靠,还是决定了要更换一下底层。 我们重新审视了下pipeline,觉得这才是正确的做法,可惜不知道如果做成一个产品样子的东西,用户方Dockerfile都不怎么会写,你让他写一个Jenkinsfile?不合理!在此之外,我们看到了serverless jenkins、谷歌的tekton。 GitLab-CICD Gitlab中自带了cicd的工具,需要配置一下runner,然后配置一下.gitlab-ci.yml写一下程序的cicd过程即可,构建镜像的时候我们使用的是kaniko,整个gitlab的cicd在我们公司小项目中大范围使用,但是学习成本过高,尤其是引入了kaniko之后,还是寻找一个产品化的CICD方案。

分布式构建jenkins x 首先要解决的是多个构建同时运行的问题,很久之前就调研过jenkins x,它必须要使用在kubernetes上,由于当时官方文档不全,而且我们的DevOps项目处于初始期,所有没有使用。jenkins的master slave结构就不多说了。jenkins x应该说是个全家桶,包含了helm仓库、nexus仓库、docker registry等,代码是jenkins-x-imageopen in new window

serverless jenkins 好像跟谷歌的tekton相关,用了下,没调通,只能用于GitHub。感觉还不如直接使用tekton。

阿里云云效 提供了图形化配置DevOps流程,支持定时触发,可惜没有跟gitlab触发结合,如果需要个公司级的DevOps,需要将公司的jira、gitlab、jenkins等集合起来,但是图形化jenkins pipeline是个特别好的参考方向,可以结合阿里云云效来做一个自己的DevOps产品。

微软Pipeline 微软也是提供了DevOps解决方案的,也是提供了yaml格式的写法,即:在右边填写完之后会转化成yaml。如果想把DevOps打造成一款产品,这样的设计显然不是最好的。

谷歌tekton kubernetes的官方cicd,目前已用于kubernetes的release发版过程,目前也仅仅是与GitHub相结合,gitlab无法使用,全过程可使用yaml文件来创建,跑起来就是类似kubernetes的job一样,用完即销毁,可惜目前比较新,依旧处于alpha版本,无法用于生产。有兴趣可以参考下:Knative 初体验:CICD 极速入门 open in new window

四、产品化后的DevOps平台

在调研DockOne以及各个产商的DevOps产品时,发现,真的只有阿里云的云效才是真正比较完美的DevOps产品,用户不需要知道pipeline的语法,也不需要掌握kubernetes的相关知识,甚至不用写yaml文件,对于开发、测试来说简直就是神一样的存在了。云效对小公司(创业公司)免费,但是有一定的量之后,就要开始收费了。在调研了一番云效的东西之后,发现云效也是基于jenkins x改造的,不过阿里毕竟人多,虽然能约莫看出是pipeline的语法,但是阿里彻底改造成了能够使用yaml来与后台交互。 下面是以阿里云的云效界面以及配合jenkins的pipeline语法来讲解:

4.1 Java代码扫描

PMD是一款可拓展的静态代码分析器它不仅可以对代码分析器,它不仅可以对代码风格进行检查,还可以检查设计、多线程、性能等方面的问题。阿里云的是简单的集成了一下而已,对于我们来说,底层使用了sonar来接入,所有的代码扫描结果都接入了sonar。

stage('Clone') {
+    steps{
+        git branch: 'master', credentialsId: 'xxxx', url: "xxx"
+    }
+}
+stage('check') {
+    steps{
+        container('maven') {
+            echo "mvn pmd:pmd"
+        }
+    }
+}
+

4.2 Java单元测试

Java的单元测试一般用的是Junit,在阿里云中,使用了surefire插件,用来在maven构建生命周期的test phase执行一个应用的单元测试。它会产生两种不同形式的测试结果报告。我这里就简单的过一下,使用"mvn test"命令来代替。


+stage('Clone') {
+    steps{
+        echo "1.Clone Stage"
+        git branch: 'master', credentialsId: 'xxxxx', url: "xxxxxx"
+    }
+}
+stage('test') {
+    steps{
+        container('maven') {
+            sh "mvn test"
+        }
+    }
+}
+

4.3 Java构建并上传镜像

镜像的构建比较想使用kaniko,尝试找了不少方法,到最后还是只能使用dind(docker in docker),挂载宿主机的docker来进行构建,如果能有其他方案,希望能提醒下。目前jenkins x使用的是dind,挂载的时候需要配置一下config.json,然后挂载到容器的/root/.docker目录,才能在容器中使用docker。

为什么不推荐dind:挂载了宿主机的docker,就可以使用docker ps查看正在运行的容器,也就意味着可以使用docker stop、docker rm来控制宿主机的容器,虽然kubernetes会重新调度起来,但是这一段的重启时间极大的影响业务。


+stage('下载代码') {
+    steps{
+        echo "1.Clone Stage"
+        git branch: 'master', credentialsId: 'xxxxx', url: "xxxxxx"
+        script {
+            build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
+        }
+    }
+}
+stage('打包并构建镜像') {
+    steps{
+        container('maven') {
+            echo "3.Build Docker Image Stage"
+            sh "mvn clean install -Dmaven.test.skip=true"
+            sh "docker build -f xxx/Dockerfile -t xxxxxx:${build_tag} ."
+            sh "docker push xxxxxx:${build_tag}"
+        }
+    }
+}
+
+

4.4 部署到阿里云k8s

CD过程有点困难,由于我们的kubernetes平台是图形化的,类似于阿里云,用户根本不需要自己写deployment,只需要在图形化界面做一下操作即可部署。对于CD过程来说,如果应用存在的话,就可以直接替换掉镜像版本即可,如果没有应用,就提供个简单的界面让用户新建应用。当然,在容器最初推行的时候,对于用户来说,一下子需要接受docker、kubernetes、helm等概念是十分困难的,不能一个一个帮他们写deployment这些yaml文件,只能用helm创建一个通用的spring boot或者其他的模板,然后让业务方修改自己的配置,每次构建的时候只需要替换镜像即可。

def tmp = sh (
+    returnStdout: true,
+    script: "kubectl get deployment -n ${namespace} | grep ${JOB_NAME} | awk '{print \$1}'"
+)
+//如果是第一次,则使用helm模板创建,创建完后需要去epaas修改pod的配置
+if(tmp.equals('')){
+    sh "helm init --client-only"
+    sh """helm repo add mychartmuseum http://xxxxxx \
+                       --username myuser \
+                       --password=mypass"""
+    sh """helm install --set name=${JOB_NAME} \
+                       --set namespace=${namespace} \
+                       --set deployment.image=${image} \
+                       --set deployment.imagePullSecrets=${harborProject} \
+                       --name ${namespace}-${JOB_NAME} \
+                       mychartmuseum/soa-template"""
+}else{
+    println "已经存在,替换镜像"
+    //epaas中一个pod的容器名称需要带上"-0"来区分
+    sh "kubectl set image deployment/${JOB_NAME} ${JOB_NAME}-0=${image} -n ${namespace}"
+}
+
+

4.5 整体流程

代码扫描,单元测试,构建镜像三个并行运行,等三个完成之后,在进行部署

pipeline:

pipeline {
+    agent {
+        label "jenkins-maven"
+    }
+    stages{
+        stage('代码扫描,单元测试,镜像构建'){
+            parallel {
+                stage('并行任务一') {
+                    agent {
+                        label "jenkins-maven"
+                    }
+                    stages('Java代码扫描') {
+                        stage('Clone') {
+                            steps{
+                                git branch: 'master', credentialsId: 'xxxxxxx', url: "xxxxxxx"
+                            }
+                        }
+                        stage('check') {
+                            steps{
+                                container('maven') {
+                                    echo "$BUILD_NUMBER"
+                                }
+                            }
+                        }
+                    }
+                }
+                stage('并行任务二') {
+                    agent {
+                        label "jenkins-maven"
+                    }
+                    stages('Java单元测试') {
+                        stage('Clone') {
+                            steps{
+                                echo "1.Clone Stage"
+                                git branch: 'master', credentialsId: 'xxxxxxx', url: "xxxxxxx"
+                            }
+                        }
+                        stage('test') {
+                            steps{
+                                container('maven') {
+                                    echo "3.Build Docker Image Stage"
+                                    sh "mvn -v"
+                                }
+                            }
+                        }
+                    }
+                }
+                stage('并行任务三') {
+                    agent {
+                        label "jenkins-maven"
+                    }
+                    stages('java构建镜像') {
+                        stage('Clone') {
+                            steps{
+                                echo "1.Clone Stage"
+                                git branch: 'master', credentialsId: 'xxxxxxx', url: "xxxxxxx"
+                                script {
+                                    build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
+                                }
+                            }
+                        }
+                        stage('Build') {
+                            steps{
+                                container('maven') {
+                                    echo "3.Build Docker Image Stage"
+                                    sh "mvn clean install -Dmaven.test.skip=true"
+                                    sh "docker build -f epaas-portal/Dockerfile -t hub.gcloud.lab/rongqiyun/epaas:${build_tag} ."
+                                    sh "docker push hub.gcloud.lab/rongqiyun/epaas:${build_tag}"
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        stage('部署'){
+            stages('部署到容器云') {
+                stage('check') {
+                    steps{
+                        container('maven') {
+                            script{
+                                if (deploy_app == "true"){
+                                    def tmp = sh (
+                                        returnStdout: true,
+                                        script: "kubectl get deployment -n ${namespace} | grep ${JOB_NAME} | awk '{print \$1}'"
+                                    )
+                                    //如果是第一次,则使用helm模板创建,创建完后需要去epaas修改pod的配置
+                                    if(tmp.equals('')){
+                                        sh "helm init --client-only"
+                                        sh """helm repo add mychartmuseum http://xxxxxx \
+                                                           --username myuser \
+                                                           --password=mypass"""
+                                        sh """helm install --set name=${JOB_NAME} \
+                                                           --set namespace=${namespace} \
+                                                           --set deployment.image=${image} \
+                                                           --set deployment.imagePullSecrets=${harborProject} \
+                                                           --name ${namespace}-${JOB_NAME} \
+                                                           mychartmuseum/soa-template"""
+                                    }else{
+                                        println "已经存在,替换镜像"
+                                        //epaas中一个pod的容器名称需要带上"-0"来区分
+                                        sh "kubectl set image deployment/${JOB_NAME} ${JOB_NAME}-0=${image} -n ${namespace}"
+                                    }
+                                }else{
+                                    println "用户选择不部署代码"
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+

在jenkins x中查看:

4.4 日志

jenkins blue ocean步骤日志:

云效中的日志:

4.5 定时触发

    triggers {
+        cron('H H * * *') //每天
+    }
+

五、其他

5.1 Gitlab触发

pipeline中除了有对于时间的trigger,还支持了gitlab的触发,需要各种配置,不过如果真的对于gitlab的cicd有要求,直接使用gitlab-ci会更好,我们同时也对gitlab进行了runner的配置来支持gitlab的cicd。gitlab的cicd也提供了构建完后即销毁的过程。

六、总结

功能最强大的过程莫过于自己使用pipeline脚本实现,选取最适合自己的,但是对于一个公司来说,如果要求业务方来掌握这些,特别是IT流动性大的时候,既需要重新培训,同个问题又会被问多遍,所以,只能将DevOps实现成一个图形化的东西,方便,简单,相对来说功能还算强大。

DevOps最难的可能都不是以上这些,关键是让用户接受,容器云最初推行时,公司原本传统的很多发版方式都需要进行改变,有些业务方不愿意改,或者有些代码把持久化的东西存到了代码中而不是分布式存储里,甚至有些用户方都不愿意维护老代码,看都不想看然后想上容器,一个公司在做技术架构的时候,过于混乱到最后填坑要么需要耗费太多精力甚至大换血。

最后,DevOps是云原生的必经之路!!!

文章同步:
博客园:https://www.cnblogs.com/w1570631036/p/11524673.htmlopen in new window
个人网站:http://www.wenzhihuai.com/getblogdetail.html?blogid=663open in new window
gitbook:https://gitbook.wenzhihuai.com/devops/devops-ping-taiopen in new window

+ + + diff --git a/devops/gitlab-ci.html b/devops/gitlab-ci.html new file mode 100644 index 00000000..733a7d5a --- /dev/null +++ b/devops/gitlab-ci.html @@ -0,0 +1,46 @@ + + + + + + + + + + Git | 个人博客 + + + + + + + + + diff --git a/devops/index.html b/devops/index.html new file mode 100644 index 00000000..71bcadf4 --- /dev/null +++ b/devops/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 三、DevOps | 个人博客 + + + + + + + + + diff --git a/devops/jenkins-x.html b/devops/jenkins-x.html new file mode 100644 index 00000000..7a8093a1 --- /dev/null +++ b/devops/jenkins-x.html @@ -0,0 +1,46 @@ + + + + + + + + + + jenkins-x | 个人博客 + + + + + + + + + diff --git a/devops/tekton.html b/devops/tekton.html new file mode 100644 index 00000000..40cf160a --- /dev/null +++ b/devops/tekton.html @@ -0,0 +1,46 @@ + + + + + + + + + + tekton | 个人博客 + + + + + + + + + diff --git a/donate/index.html b/donate/index.html new file mode 100644 index 00000000..e061eefe --- /dev/null +++ b/donate/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 微信支付 | 个人博客 + + + + + +
跳至主要內容

微信支付

Zephery约 9 字小于 1 分钟

微信支付

微信支付
微信支付
+ + + diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 00000000..19318875 Binary files /dev/null and b/favicon.ico differ diff --git a/home.html b/home.html new file mode 100644 index 00000000..8309c80b --- /dev/null +++ b/home.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 00000000..48f22688 --- /dev/null +++ b/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/interview/index.html b/interview/index.html new file mode 100644 index 00000000..0a919cc7 --- /dev/null +++ b/interview/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + Interview | 个人博客 + + + + + + + + + diff --git a/interview/jvm.html b/interview/jvm.html new file mode 100644 index 00000000..1c78b400 --- /dev/null +++ b/interview/jvm.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/interview/kafka.html b/interview/kafka.html new file mode 100644 index 00000000..bc5125e9 --- /dev/null +++ b/interview/kafka.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + +
跳至主要內容

Zephery约 5099 字大约 17 分钟

1、请说明什么是Apache Kafka?
Apache Kafka是由Apache开发的一种发布订阅消息系统,它是一个分布式的、分区的和可复制的提交日志服务。

2、说说Kafka的使用场景?
①异步处理
②应用解耦
③流量削峰
④日志处理
⑤消息通讯等。

3、使用Kafka有什么优点和缺点?
优点:
①支持跨数据中心的消息复制;
②单机吞吐量:十万级,最大的优点,就是吞吐量高;
③topic数量都吞吐量的影响:topic从几十个到几百个的时候,吞吐量会大幅度下降。所以在同等机器下,kafka尽量保证topic数量不要过多。如果要支撑大规模topic,需要增加更多的机器资源;
④时效性:ms级;
⑤可用性:非常高,kafka是分布式的,一个数据多个副本,少数机器宕机,不会丢失数据,不会导致不可用;
⑥消息可靠性:经过参数优化配置,消息可以做到0丢失;
⑦功能支持:功能较为简单,主要支持简单的MQ功能,在大数据领域的实时计算以及日志采集被大规模使用。

缺点:
①由于是批量发送,数据并非真正的实时; 仅支持统一分区内消息有序,无法实现全局消息有序;
②有可能消息重复消费;
③依赖zookeeper进行元数据管理,等等。

4、为什么说Kafka性能很好,体现在哪里?
①顺序读写
②零拷贝
③分区
④批量发送
⑤数据压缩

5、请说明什么是传统的消息传递方法?
传统的消息传递方法包括两种:
排队:在队列中,一组用户可以从服务器中读取消息,每条消息都发送给其中一个人。
发布-订阅:在这个模型中,消息被广播给所有的用户。

6、请说明Kafka相对传统技术有什么优势?
①快速:单一的Kafka代理可以处理成千上万的客户端,每秒处理数兆字节的读写操作。
②可伸缩:在一组机器上对数据进行分区
③和简化,以支持更大的数据
④持久:消息是持久性的,并在集群中进
⑤行复制,以防止数据丢失。
⑥设计:它提供了容错保证和持久性

7、解释Kafka的Zookeeper是什么?我们可以在没有Zookeeper的情况下使用Kafka吗?
Zookeeper是一个开放源码的、高性能的协调服务,它用于Kafka的分布式应用。
不,不可能越过Zookeeper,直接联系Kafka broker。一旦Zookeeper停止工作,它就不能服务客户端请求。
Zookeeper主要用于在集群中不同节点之间进行通信
在Kafka中,它被用于提交偏移量,因此如果节点在任何情况下都失败了,它都可以从之前提交的偏移量中获取
除此之外,它还执行其他活动,如: leader检测、分布式同步、配置管理、识别新节点何时离开或连接、集群、节点实时状态等等。

8、解释Kafka的用户如何消费信息?
在Kafka中传递消息是通过使用sendfile API完成的。它支持将字节从套接口转移到磁盘,通过内核空间保存副本,并在内核用户之间调用内核。

9、解释如何提高远程用户的吞吐量?
如果用户位于与broker不同的数据中心,则可能需要调优套接口缓冲区大小,以对长网络延迟进行摊销。

10、解释一下,在数据制作过程中,你如何能从Kafka得到准确的信息?
在数据中,为了精确地获得Kafka的消息,你必须遵循两件事: 在数据消耗期间避免重复,在数据生产过程中避免重复。
这里有两种方法,可以在数据生成时准确地获得一个语义:
每个分区使用一个单独的写入器,每当你发现一个网络错误,检查该分区中的最后一条消息,以查看您的最后一次写入是否成功
在消息中包含一个主键(UUID或其他),并在用户中进行反复制

11、解释如何减少ISR中的扰动?broker什么时候离开ISR?
ISR是一组与leaders完全同步的消息副本,也就是说ISR中包含了所有提交的消息。ISR应该总是包含所有的副本,直到出现真正的故障。如果一个副本从leader中脱离出来,将会从ISR中删除。

12、Kafka为什么需要复制?
Kafka的信息复制确保了任何已发布的消息不会丢失,并且可以在机器错误、程序错误或更常见些的软件升级中使用。

13、如果副本在ISR中停留了很长时间表明什么?
如果一个副本在ISR中保留了很长一段时间,那么它就表明,跟踪器无法像在leader收集数据那样快速地获取数据。

14、请说明如果首选的副本不在ISR中会发生什么?
如果首选的副本不在ISR中,控制器将无法将leadership转移到首选的副本。

15、有可能在生产后发生消息偏移吗?
在大多数队列系统中,作为生产者的类无法做到这一点,它的作用是触发并忘记消息。broker将完成剩下的工作,比如使用id进行适当的元数据处理、偏移量等。

作为消息的用户,你可以从Kafka broker中获得补偿。如果你注视SimpleConsumer类,你会注意到它会获取包括偏移量作为列表的MultiFetchResponse对象。此外,当你对Kafka消息进行迭代时,你会拥有包括偏移量和消息发送的MessageAndOffset对象。

16、Kafka的设计时什么样的呢?
Kafka将消息以topic为单位进行归纳 将向Kafka topic发布消息的程序成为producers. 将预订topics并消费消息的程序成为consumer. Kafka以集群的方式运行,可以由一个或多个服务组成,每个服务叫做一个broker. producers通过网络将消息发送到Kafka集群,集群向消费者提供消息

17、数据传输的事物定义有哪三种?
(1)最多一次:
消息不会被重复发送,最多被传输一次,但也有可能一次不传输
(2)最少一次: 消息不会被漏发送,最少被传输一次,但也有可能被重复传输.
(3)精确的一次(Exactly once): 不会漏传输也不会重复传输,每个消息都传输被一次而且仅仅被传输一次,这是大家所期望的

18、Kafka判断一个节点是否还活着有那两个条件?
(1)节点必须可以维护和ZooKeeper的连接,Zookeeper通过心跳机制检查每个节点的连接
(2)如果节点是个follower,他必须能及时的同步leader的写操作,延时不能太久

19、producer是否直接将数据发送到broker的leader(主节点)?
producer直接将数据发送到broker的leader(主节点),不需要在多个节点进行分发,为了帮助producer做到这点,所有的Kafka节点都可以及时的告知:哪些节点是活动的,目标topic目标分区的leader在哪。这样producer就可以直接将消息发送到目的地了。

20、Kafa consumer是否可以消费指定分区消息?
Kafa consumer消费消息时,向broker发出"fetch"请求去消费特定分区的消息,consumer指定消息在日志中的偏移量(offset),就可以消费从这个位置开始的消息,customer拥有了offset的控制权,可以向后回滚去重新消费之前的消息,这是很有意义的

21、Kafka消息是采用Pull模式,还是Push模式?
Kafka最初考虑的问题是,customer应该从brokes拉取消息还是brokers将消息推送到consumer,也就是pull还push。在这方面,Kafka遵循了一种大部分消息系统共同的传统的设计:producer将消息推送到broker,consumer从broker拉取消息一些消息系统比如Scribe和Apache Flume采用了push模式,将消息推送到下游的consumer。这样做有好处也有坏处:由broker决定消息推送的速率,对于不同消费速率的consumer就不太好处理了。消息系统都致力于让consumer以最大的速率最快速的消费消息,但不幸的是,push模式下,当broker推送的速率远大于consumer消费的速率时,consumer恐怕就要崩溃了。最终Kafka还是选取了传统的pull模式

Pull模式的另外一个好处是consumer可以自主决定是否批量的从broker拉取数据。Push模式必须在不知道下游consumer消费能力和消费策略的情况下决定是立即推送每条消息还是缓存之后批量推送。如果为了避免consumer崩溃而采用较低的推送速率,将可能导致一次只推送较少的消息而造成浪费。Pull模式下,consumer就可以根据自己的消费能力去决定这些策略

Pull有个缺点是,如果broker没有可供消费的消息,将导致consumer不断在循环中轮询,直到新消息到t达。为了避免这点,Kafka有个参数可以让consumer阻塞知道新消息到达(当然也可以阻塞知道消息的数量达到某个特定的量这样就可以批量发

22、Kafka存储在硬盘上的消息格式是什么?
消息由一个固定长度的头部和可变长度的字节数组组成。头部包含了一个版本号和CRC32校验码。
消息长度: 4 bytes (value: 1+4+n)
版本号: 1 byte
CRC校验码: 4 bytes
具体的消息: n bytes

23、Kafka高效文件存储设计特点:
(1).Kafka把topic中一个parition大文件分成多个小文件段,通过多个小文件段,就容易定期清除或删除已经消费完文件,减少磁盘占用。
(2).通过索引信息可以快速定位message和确定response的最大大小。
(3).通过index元数据全部映射到memory,可以避免segment file的IO磁盘操作。
(4).通过索引文件稀疏存储,可以大幅降低index文件元数据占用空间大小。

24、Kafka 与传统消息系统之间有三个关键区别
(1).Kafka 持久化日志,这些日志可以被重复读取和无限期保留
(2).Kafka 是一个分布式系统:它以集群的方式运行,可以灵活伸缩,在内部通过复制数据提升容错能力和高可用性
(3).Kafka 支持实时的流式处理

25、Kafka创建Topic时如何将分区放置到不同的Broker中
副本因子不能大于 Broker 的个数;
第一个分区(编号为0)的第一个副本放置位置是随机从 brokerList 选择的;
其他分区的第一个副本放置位置相对于第0个分区依次往后移。也就是如果我们有5个 Broker,5个分区,假设第一个分区放在第四个 Broker 上,那么第二个分区将会放在第五个 Broker 上;第三个分区将会放在第一个 Broker 上;第四个分区将会放在第二个 Broker 上,依次类推;
剩余的副本相对于第一个副本放置位置其实是由 nextReplicaShift 决定的,而这个数也是随机产生的

26、Kafka新建的分区会在哪个目录下创建
在启动 Kafka 集群之前,我们需要配置好 log.dirs 参数,其值是 Kafka 数据的存放目录,这个参数可以配置多个目录,目录之间使用逗号分隔,通常这些目录是分布在不同的磁盘上用于提高读写性能。 当然我们也可以配置 log.dir 参数,含义一样。只需要设置其中一个即可。 如果 log.dirs 参数只配置了一个目录,那么分配到各个 Broker 上的分区肯定只能在这个目录下创建文件夹用于存放数据。 但是如果 log.dirs 参数配置了多个目录,那么 Kafka 会在哪个文件夹中创建分区目录呢?答案是:Kafka 会在含有分区目录最少的文件夹中创建新的分区目录,分区目录名为 Topic名+分区ID。注意,是分区文件夹总数最少的目录,而不是磁盘使用量最少的目录!也就是说,如果你给 log.dirs 参数新增了一个新的磁盘,新的分区目录肯定是先在这个新的磁盘上创建直到这个新的磁盘目录拥有的分区目录不是最少为止。

27、partition的数据如何保存到硬盘
topic中的多个partition以文件夹的形式保存到broker,每个分区序号从0递增, 且消息有序 Partition文件下有多个segment(xxx.index,xxx.log) segment 文件里的 大小和配置文件大小一致可以根据要求修改 默认为1g 如果大小大于1g时,会滚动一个新的segment并且以上一个segment最后一条消息的偏移量命名

28、kafka的ack机制
request.required.acks有三个值 0 1 -1
0:生产者不会等待broker的ack,这个延迟最低但是存储的保证最弱当server挂掉的时候就会丢数据
1:服务端会等待ack值 leader副本确认接收到消息后发送ack但是如果leader挂掉后他不确保是否复制完成新leader也会导致数据丢失
-1:同样在1的基础上 服务端会等所有的follower的副本受到数据后才会受到leader发出的ack,这样数据不会丢失

29、Kafka的消费者如何消费数据
消费者每次消费数据的时候,消费者都会记录消费的物理偏移量(offset)的位置 等到下次消费时,他会接着上次位置继续消费。同时也可以按照指定的offset进行重新消费。

30、消费者负载均衡策略
结合consumer的加入和退出进行再平衡策略。

31、kafka消息数据是否有序?
消费者组里某具体分区是有序的,所以要保证有序只能建一个分区,但是实际这样会存在性能问题,具体业务具体分析后确认。

32、kafaka生产数据时数据的分组策略,生产者决定数据产生到集群的哪个partition中
每一条消息都是以(key,value)格式 Key是由生产者发送数据传入 所以生产者(key)决定了数据产生到集群的哪个partition

33、kafka consumer 什么情况会触发再平衡reblance?
①一旦消费者加入或退出消费组,导致消费组成员列表发生变化,消费组中的所有消费者都要执行再平衡。
②订阅主题分区发生变化,所有消费者也都要再平衡。

34、描述下kafka consumer 再平衡步骤?
①关闭数据拉取线程,情空队列和消息流,提交偏移量;
②释放分区所有权,删除zk中分区和消费者的所有者关系;
③将所有分区重新分配给每个消费者,每个消费者都会分到不同分区;
④将分区对应的消费者所有关系写入ZK,记录分区的所有权信息;
⑤重启消费者拉取线程管理器,管理每个分区的拉取线程。

35、Kafka中的ISR、AR又代表什么?ISR的伸缩又指什么
36、Kafka中的HW、LEO、LSO、LW等分别代表什么?
37、Kafka中是怎么体现消息顺序性的?
38、Kafka中的分区器、序列化器、拦截器是否了解?它们之间的处理顺序是什么?
39、Kafka生产者客户端的整体结构是什么样子的?
40、Kafka生产者客户端中使用了几个线程来处理?分别是什么?
41、Kafka的旧版Scala的消费者客户端的设计有什么缺陷?
42、“消费组中的消费者个数如果超过topic的分区,那么就会有消费者消费不到数据”这句话是否正确?如果不正确,那么有没有什么hack的手段?
43、消费者提交消费位移时提交的是当前消费到的最新消息的offset还是offset+1?
44、有哪些情形会造成重复消费?
45、那些情景下会造成消息漏消费?
46、KafkaConsumer是非线程安全的,那么怎么样实现多线程消费?
47、简述消费者与消费组之间的关系
48、当你使用kafka-topics.sh创建(删除)了一个topic之后,Kafka背后会执行什么逻辑?
49、topic的分区数可不可以增加?如果可以怎么增加?如果不可以,那又是为什么?
50、topic的分区数可不可以减少?如果可以怎么减少?如果不可以,那又是为什么?
51、创建topic时如何选择合适的分区数?
52、Kafka目前有那些内部topic,它们都有什么特征?各自的作用又是什么?
53、优先副本是什么?它有什么特殊的作用?
54、Kafka有哪几处地方有分区分配的概念?简述大致的过程及原理
55、简述Kafka的日志目录结构
56、Kafka中有那些索引文件?
57、如果我指定了一个offset,Kafka怎么查找到对应的消息?
58、如果我指定了一个timestamp,Kafka怎么查找到对应的消息?
59、聊一聊你对Kafka的Log Retention的理解
60、聊一聊你对Kafka的Log Compaction的理解
61、聊一聊你对Kafka底层存储的理解(页缓存、内核层、块层、设备层)
62、聊一聊Kafka的延时操作的原理
63、聊一聊Kafka控制器的作用
64、消费再均衡的原理是什么?(提示:消费者协调器和消费组协调器)
65、Kafka中的幂等是怎么实现的
66、Kafka中的事务是怎么实现的(这题我去面试6家被问4次,照着答案念也要念十几分钟,面试官简直凑不要脸。实在记不住的话...只要简历上不写精通Kafka一般不会问到,我简历上写的是“熟悉Kafka,了解RabbitMQ....”)
67、Kafka中有那些地方需要选举?这些地方的选举策略又有哪些?
68、失效副本是指什么?有那些应对措施?
69、多副本下,各个副本中的HW和LEO的演变过程
70、为什么Kafka不支持读写分离?
71、Kafka在可靠性方面做了哪些改进?(HW, LeaderEpoch)
72、Kafka中怎么实现死信队列和重试队列?
73、Kafka中的延迟队列怎么实现(这题被问的比事务那题还要多!!!听说你会Kafka,那你说说延迟队列怎么实现?)
74、Kafka中怎么做消息审计?
75、Kafka中怎么做消息轨迹?
76、Kafka中有那些配置参数比较有意思?聊一聊你的看法
77、Kafka中有那些命名比较有意思?聊一聊你的看法
78、Kafka有哪些指标需要着重关注?
79、怎么计算Lag?(注意read_uncommitted和read_committed状态下的不同)
80、Kafka的那些设计让它有如此高的性能?
81、Kafka有什么优缺点?
82、还用过什么同质类的其它产品,与Kafka相比有什么优缺点?
83、为什么选择Kafka?
84、在使用Kafka的过程中遇到过什么困难?怎么解决的?
85、怎么样才能确保Kafka极大程度上的可靠性?
86、聊一聊你对Kafka生态的理解

+ + + diff --git a/interview/kubernetes.html b/interview/kubernetes.html new file mode 100644 index 00000000..1deab634 --- /dev/null +++ b/interview/kubernetes.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/interview/mysql.html b/interview/mysql.html new file mode 100644 index 00000000..c828503b --- /dev/null +++ b/interview/mysql.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/interview/tiktok2023.html b/interview/tiktok2023.html new file mode 100644 index 00000000..b4a62dfe --- /dev/null +++ b/interview/tiktok2023.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + +
跳至主要內容

Zephery约 344 字大约 1 分钟

tt一面:
1.全程项目
2.lc3,最长无重复子串,滑动窗口解决

tt二面:
全程基础,一直追问
1.java内存模型介绍一下
2.volatile原理
3.内存屏障,使用场景?(我提了在gc中有使用)
4.gc中具体是怎么使用内存屏障的,详细介绍
5.cms和g1介绍一下,g1能取代cms吗?g1和cms各自的使用场景是什么
6.线程内存分配方式,tlab相关
7.happens-before介绍一下
8.总线风暴是什么,怎么解决
9.网络相关,time_wait,close_wait产生原因,带来的影响,怎么解决
10.算法题,给你一个数字n,求用这个n的各位上的数字组合出最大的小于n的数字m,注意边界case,如2222
11.场景题,设计一个微信朋友圈,功能包含feed流拉取,评论,转发,点赞等操作

tt三面:
大部分聊项目,基础随便问了问
1.分布式事务,两阶段三阶段流程,区别
2.mysql主从,同步复制,半同步复制,异步复制
3.算法题,k个一组翻转链表,类似lc25,区别是最后一组不足k个也要翻转
4.场景题,设计一个评论系统,包含发布评论,回复评论,评论点赞等功能,用户过亿,qps百万

+ + + diff --git "a/java/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html" "b/java/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html" new file mode 100644 index 00000000..ff3e4602 --- /dev/null +++ "b/java/JVM\350\260\203\344\274\230\345\217\202\346\225\260.html" @@ -0,0 +1,78 @@ + + + + + + + + + + JVM调优参数 | 个人博客 + + + + + +
跳至主要內容

JVM调优参数

Zephery约 2739 字大约 9 分钟

JVM调优参数

一、堆大小设置

JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可用虚拟内存限制;系统的可用物理内存限制。32位系统 下,一般限制在1.5G~2G;64为操作系统对内存无限制。我在Windows Server 2003 系统,3.5G物理内存,JDK5.0下测试,最大可设置为1478m。

典型设置:

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k
+

-Xmx3550m:设置JVM最大可用内存为3550M。
-Xms3550m:设置JVM促使内存为3550m。此值可以设置与-Xmx相同,以避免每次垃圾回收完成后JVM重新分配内存。
-Xmn2g:设置年轻代大小为2G。整个JVM内存大小=年轻代大小 + 年老代大小 + 持久代大小。持久代一般固定大小为64m,所以增大年轻代后,将会减小年老代大小。此值对系统性能影响较大,Sun官方推荐配置为整个堆的3/8。
-Xss128k: 设置每个线程的堆栈大小。JDK5.0以后每个线程堆栈大小为1M,以前每个线程堆栈大小为256K。更具应用的线程所需内存大小进行调整。在相同物理内 存下,减小这个值能生成更多的线程。但是操作系统对一个进程内的线程数还是有限制的,不能无限生成,经验值在3000~5000左右。

java -Xmx3550m -Xms3550m -Xss128k -XX:NewRatio=4 -XX:SurvivorRatio=4 -XX:MaxPermSize=16m -XX:MaxTenuringThreshold=0
+

-XX:NewRatio=4:设置年轻代(包括Eden和两个Survivor区)与年老代的比值(除去持久代)。设置为4,则年轻代与年老代所占比值为1:4,年轻代占整个堆栈的1/5
-XX:SurvivorRatio=4:设置年轻代中Eden区与Survivor区的大小比值。设置为4,则两个Survivor区与一个Eden区的比值为2:4,一个Survivor区占整个年轻代的1/6
-XX:MaxPermSize=16m:设置持久代大小为16m。
-XX:MaxTenuringThreshold=0:设置垃圾最大年龄。如果设置为0的话,则年轻代对象不经过Survivor区,直接进入年老代。对于年老代比较多的应用,可以提高效率。如果将此值设置为一个较大值,则年轻代对象会在Survivor区进行多次复制,这样可以增加对象再年轻代的存活时间,增加在年轻代即被回收的概论。

二、回收器选择

JVM给了三种选择:串行收集器、并行收集器、并发收集器,但是串行收集器只适用于小数据量的情况,所以这里的选择主要针对并行收集器和并发收集器。默认情况下,JDK5.0以前都是使用串行收集器,如果想使用其他收集器需要在启动时加入相应参数。JDK5.0以后,JVM会根据当前系统配置进行判断。

2.1 吞吐量优先的并行收集器

如上文所述,并行收集器主要以到达一定的吞吐量为目标,适用于科学技术和后台处理等。
典型配置:

java -Xmx3800m -Xms3800m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20
+

-XX:+UseParallelGC:选择垃圾收集器为并行收集器。此配置仅对年轻代有效。即上述配置下,年轻代使用并发收集,而年老代仍旧使用串行收集。
-XX:ParallelGCThreads=20:配置并行收集器的线程数,即:同时多少个线程一起进行垃圾回收。此值最好配置与处理器数目相等。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC  
+

-XX:+UseParallelOldGC:配置年老代垃圾收集方式为并行收集。JDK6.0支持对年老代并行收集。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC  -XX:MaxGCPauseMillis=100  
+

-XX:MaxGCPauseMillis=100:设置每次年轻代垃圾回收的最长时间,如果无法满足此时间,JVM会自动调整年轻代大小,以满足此值。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC  -XX:MaxGCPauseMillis=100 -XX:+UseAdaptiveSizePolicy
+

-XX:+UseAdaptiveSizePolicy:设置此选项后,并行收集器会自动选择年轻代区大小和相应的Survivor区比例,以达到目标系统规定的最低相应时间或者收集频率等,此值建议使用并行收集器时,一直打开。

2.2 响应时间优先的并发收集器

如上文所述,并发收集器主要是保证系统的响应时间,减少垃圾收集时的停顿时间。适用于应用服务器、电信领域等。
典型配置:

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
+

-XX:+UseConcMarkSweepGC:设置年老代为并发收集。测试中配置这个以后,-XX:NewRatio=4的配置失效了,原因不明。所以,此时年轻代大小最好用-Xmn设置。
-XX:+UseParNewGC:设置年轻代为并行收集。可与CMS收集同时使用。JDK5.0以上,JVM会根据系统配置自行设置,所以无需再设置此值。

java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseConcMarkSweepGC -XX:CMSFullGCsBeforeCompaction=5 -XX:+UseCMSCompactAtFullCollection
+

-XX:CMSFullGCsBeforeCompaction:由于并发收集器不对内存空间进行压缩、整理,所以运行一段时间以后会产生“碎片”,使得运行效率降低。此值设置运行多少次GC以后对内存空间进行压缩、整理。
-XX:+UseCMSCompactAtFullCollection:打开对年老代的压缩。可能会影响性能,但是可以消除碎片

三、辅助信息

JVM提供了大量命令行参数,打印信息,供调试使用。主要有以下一些:
-XX:+PrintGC
输出形式:[GC 118250K->113543K(130112K), 0.0094143 secs]
                [Full GC 121376K->10414K(130112K), 0.0650971 secs]

-XX:+PrintGCDetails
输出形式:[GC [DefNew: 8614K->781K(9088K), 0.0123035 secs] 118250K->113543K(130112K), 0.0124633 secs]
                [GC [DefNew: 8614K->8614K(9088K), 0.0000665 secs][Tenured: 112761K->10414K(121024K), 0.0433488 secs] 121376K->10414K(130112K), 0.0436268 secs]

-XX:+PrintGCTimeStamps -XX:+PrintGC:PrintGCTimeStamps可与上面两个混合使用
输出形式:11.851: [GC 98328K->93620K(130112K), 0.0082960 secs]
-XX:+PrintGCApplicationConcurrentTime:打印每次垃圾回收前,程序未中断的执行时间。可与上面混合使用
输出形式:Application time: 0.5291524 seconds
-XX:+PrintGCApplicationStoppedTime:打印垃圾回收期间程序暂停的时间。可与上面混合使用
输出形式:Total time for which application threads were stopped: 0.0468229 seconds
-XX:PrintHeapAtGC:打印GC前后的详细堆栈信息
输出形式:

34.702: [GC {Heap before gc invocations=7:
+ def new generation   total 55296K, used 52568K [0x1ebd0000, 0x227d0000, 0x227d0000)
+eden space 49152K,  99% used [0x1ebd0000, 0x21bce430, 0x21bd0000)
+from space 6144K,  55% used [0x221d0000, 0x22527e10, 0x227d0000)
+  to   space 6144K,   0% used [0x21bd0000, 0x21bd0000, 0x221d0000)
+ tenured generation   total 69632K, used 2696K [0x227d0000, 0x26bd0000, 0x26bd0000)
+the space 69632K,   3% used [0x227d0000, 0x22a720f8, 0x22a72200, 0x26bd0000)
+ compacting perm gen  total 8192K, used 2898K [0x26bd0000, 0x273d0000, 0x2abd0000)
+   the space 8192K,  35% used [0x26bd0000, 0x26ea4ba8, 0x26ea4c00, 0x273d0000)
+    ro space 8192K,  66% used [0x2abd0000, 0x2b12bcc0, 0x2b12be00, 0x2b3d0000)
+    rw space 12288K,  46% used [0x2b3d0000, 0x2b972060, 0x2b972200, 0x2bfd0000)
+34.735: [DefNew: 52568K->3433K(55296K), 0.0072126 secs] 55264K->6615K(124928K)Heap after gc invocations=8:
+ def new generation   total 55296K, used 3433K [0x1ebd0000, 0x227d0000, 0x227d0000)
+eden space 49152K,   0% used [0x1ebd0000, 0x1ebd0000, 0x21bd0000)
+  from space 6144K,  55% used [0x21bd0000, 0x21f2a5e8, 0x221d0000)
+  to   space 6144K,   0% used [0x221d0000, 0x221d0000, 0x227d0000)
+ tenured generation   total 69632K, used 3182K [0x227d0000, 0x26bd0000, 0x26bd0000)
+the space 69632K,   4% used [0x227d0000, 0x22aeb958, 0x22aeba00, 0x26bd0000)
+ compacting perm gen  total 8192K, used 2898K [0x26bd0000, 0x273d0000, 0x2abd0000)
+   the space 8192K,  35% used [0x26bd0000, 0x26ea4ba8, 0x26ea4c00, 0x273d0000)
+    ro space 8192K,  66% used [0x2abd0000, 0x2b12bcc0, 0x2b12be00, 0x2b3d0000)
+    rw space 12288K,  46% used [0x2b3d0000, 0x2b972060, 0x2b972200, 0x2bfd0000)
+}
+, 0.0757599 secs]
+

-Xloggc:filename:与上面几个配合使用,把相关日志信息记录到文件以便分析。
常见配置汇总

3.1 堆设置

-Xms:初始堆大小
-Xmx:最大堆大小
-XX:NewSize=n:设置年轻代大小
-XX:NewRatio=n:设置年轻代和年老代的比值。如:为3,表示年轻代与年老代比值为1:3,年轻代占整个年轻代年老代和的1/4
-XX:SurvivorRatio=n:年轻代中Eden区与两个Survivor区的比值。注意Survivor区有两个。如:3,表示Eden:Survivor=3:2,一个Survivor区占整个年轻代的1/5
-XX:MaxPermSize=n:设置持久代大小

3.2 收集器设置

-XX:+UseSerialGC:设置串行收集器
-XX:+UseParallelGC:设置并行收集器
-XX:+UseParalledlOldGC:设置并行年老代收集器
-XX:+UseConcMarkSweepGC:设置并发收集器

3.3 垃圾回收统计信息

-XX:+PrintGC
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc:filename

3.4 并行收集器设置

-XX:ParallelGCThreads=n:设置并行收集器收集时使用的CPU数。并行收集线程数。
-XX:MaxGCPauseMillis=n:设置并行收集最大暂停时间
-XX:GCTimeRatio=n:设置垃圾回收时间占程序运行时间的百分比。公式为1/(1+n)

3.5 并发收集器设置

-XX:+CMSIncrementalMode:设置为增量模式。适用于单CPU情况。
-XX:ParallelGCThreads=n:设置并发收集器年轻代收集方式为并行收集时,使用的CPU数。并行收集线程数。

四、调优总结

4.1 年轻代大小选择

响应时间优先的应用:尽可能设大,直到接近系统的最低响应时间限制(根据实际情况选择)。在此种情况下,年轻代收集发生的频率也是最小的。同时,减少到达年老代的对象。
吞吐量优先的应用:尽可能的设置大,可能到达Gbit的程度。因为对响应时间没有要求,垃圾收集可以并行进行,一般适合8CPU以上的应用。

4.2 年老代大小选择

响应时间优先的应用:年老代使用并发收集器,所以其大小需要小心设置,一般要考虑并发会话率和会话持续时间等一些参数。如果堆设置小了,可以会造成内存碎片、高回收频率以及应用暂停而使用传统的标记清除方式;如果堆大了,则需要较长的收集时间。最优化的方案,一般需要参考以下数据获得:
并发垃圾收集信息
持久代并发收集次数
传统GC信息
花在年轻代和年老代回收上的时间比例
减少年轻代和年老代花费的时间,一般会提高应用的效率
吞吐量优先的应用:一般吞吐量优先的应用都有一个很大的年轻代和一个较小的年老代。原因是,这样可以尽可能回收掉大部分短期对象,减少中期的对象,而年老代尽存放长期存活对象。

4.3 较小堆引起的碎片问题

因为年老代的并发收集器使用标记、清除算法,所以不会对堆进行压缩。当收集器回收时,他 会把相邻的空间进行合并,这样可以分配给较大的对象。但是,当堆空间较小时,运行一段时间以后,就会出现“碎片”,如果并发收集器找不到足够的空间,那么 并发收集器将会停止,然后使用传统的标记、清除方式进行回收。如果出现“碎片”,可能需要进行如下配置:
-XX:+UseCMSCompactAtFullCollection:使用并发收集器时,开启对年老代的压缩。
-XX:CMSFullGCsBeforeCompaction=0:上面配置开启的情况下,这里设置多少次Full GC后,对年老代进行压缩

+ + + diff --git a/java/index.html b/java/index.html new file mode 100644 index 00000000..ab1f9ece --- /dev/null +++ b/java/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + Java | 个人博客 + + + + + + + + + diff --git "a/java/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html" "b/java/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html" new file mode 100644 index 00000000..0afc17fd --- /dev/null +++ "b/java/lucene\346\220\234\347\264\242\345\216\237\347\220\206.html" @@ -0,0 +1,46 @@ + + + + + + + + + + lucene搜索原理 | 个人博客 + + + + + + + + + diff --git a/java/serverlog.html b/java/serverlog.html new file mode 100644 index 00000000..efca305f --- /dev/null +++ b/java/serverlog.html @@ -0,0 +1,48 @@ + + + + + + + + + + 被挖矿攻击 | 个人博客 + + + + + +
跳至主要內容

被挖矿攻击

Zephery约 172 字小于 1 分钟

被挖矿攻击

服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看:

stratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG

使用top查看:

启动iptables,参考http://www.setphp.com/981.htmlopen in new window
http://www.setphp.com/981.htmlopen in new window

iptables -A INPUT -s xmr.crypto-pool.fr -j DROP
+iptables -A OUTPUT -d xmr.crypto-pool.fr -j DROP
+

2017-10-02 再次遭到挖矿攻击

2017-11-20

19号添加mongodb之后,20号重启了服务器,但是忘记启动mongodb,导致后台一直在重连mongodb,也就导致了服务访问超级超级慢,记住要启动所需要的组件。

2017-12-03

2017-12-05 wipefs

+ + + diff --git "a/java/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html" "b/java/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html" new file mode 100644 index 00000000..ee2c78fa --- /dev/null +++ "b/java/\344\270\200\346\254\241jvm\350\260\203\344\274\230\350\277\207\347\250\213.html" @@ -0,0 +1,54 @@ + + + + + + + + + + 一次jvm调优过程 | 个人博客 + + + + + +
跳至主要內容

一次jvm调优过程

Zephery约 1870 字大约 6 分钟

一次jvm调优过程

前端时间把公司的一个分布式定时调度的系统弄上了容器云,部署在kubernetes,在容器运行的动不动就出现问题,特别容易jvm溢出,导致程序不可用,终端无法进入,日志一直在刷错误,kubernetes也没有将该容器自动重启。业务方基本每天都在反馈task不稳定,后续就协助接手看了下,先主要讲下该程序的架构吧。
该程序task主要分为三个模块:
console进行一些cron的配置(表达式、任务名称、任务组等);
schedule主要从数据库中读取配置然后装载到quartz再然后进行命令下发;
client接收任务执行,然后向schedule返回运行的信息(成功、失败原因等)。
整体架构跟github上开源的xxl-job类似,也可以参考一下。

1. 启用jmx和远程debug模式

容器的网络使用了BGP,打通了公司的内网,所以可以直接通过ip来进行程序的调试,主要是在启动的jvm参数中添加:

JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=0.0.0.0:8000,server=y,suspend=n "
+JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
+

其中,调试模式的address最好加上0.0.0.0,有时候通过netstat查看端口的时候,该位置显示为127.0.0.1,导致无法正常debug,开启了jmx之后,可以初步观察堆内存的情况。

堆内存(特别是cms的old gen),初步看代码觉得是由于用了大量的map,本地缓存了大量数据,怀疑是每次定时调度的信息都进行了保存。

2. memory analyzer、jprofiler进行堆内存分析

先从容器中dump出堆内存

jmap -dump:live,format=b,file=heap.hprof 58
+

由图片可以看出,这些大对象不过也就10M,并没有想象中的那么大,所以并不是大对象的问题,后续继续看了下代码,虽然每次请求都会把信息放进map里,如果能正常调通的话,就会移除map中保存的记录,由于是测试环境,执行端很多时候都没有正常运行,甚至说业务方关闭了程序,导致调度一直出现问题,所以map的只会保留大量的错误请求。不过相对于该程序的堆内存来说,不是主要问题。

3. netty的方面的考虑

另一个小伙伴一直怀疑的是netty这一块有错误,着重看了下。该程序用netty自己实现了一套rpc,调度端每次进行命令下发的时候都会通过netty的rpc来进行通信,整个过程逻辑写的很混乱,下面开始排查。
首先是查看堆内存的中占比:

可以看出,io.netty.channel.nio.NioEventLoop的占比达到了40%左右,再然后是io.netty.buffer.PoolThreadCache,占比大概达到33%左右。猜想可能是传输的channel没有关闭,还是NioEventLoop没有关闭。再跑去看一下jmx的线程数:

达到了惊人的1000个左右,而且一直在增长,没有过下降的趋势,再次猜想到可能是NioEventLoop没有关闭,在代码中全局搜索NioEventLoop,找到一处比较可疑的地方。

声明了一个NioEventLoopGroup的成员变量,通过构造方法进行了初始化,但是在执行syncRequest完之后并没有进行对group进行shutdownGracefully操作,外面对其的操作并没有对该类的group对象进行关闭,导致线程数一直在增长。

最终解决办法:
在调用完syncRequest方法时,对ChannelBootStrap的group对象进行行shutdownGracefully

提交代码,容器中继续测试,可以基本看出,线程基本处于稳定状态,并不会出现一直增长的情况了

还原本以为基本解决了,到最后还是发现,堆内存还算稳定,但是,直接内存依旧打到了100%,虽然程序没有挂掉,所以,上面做的,可能仅仅是为这个程序续命了而已,感觉并没有彻底解决掉问题。

4. 直接内存排查

第一个想到的就是netty的直接内存,关掉,命令如下:

-Dio.netty.noPreferDirect=true -Dio.netty.leakDetectionLevel=advanced
+

查看了一下java的nio直接内存,发现也就几十kb,然而直接内存还是慢慢往上涨。毫无头绪,然后开始了自己的从linux层面开始排查问题

5. 推荐的直接内存排查方法

5.1 pmap

一般配合pmap使用,从内核中读取内存块,然后使用views 内存块来判断错误,我简单试了下,乱码,都是二进制的东西,看不出所以然来。

pmap -d 58  | sort -n -k2
+pmap -x 58  | sort -n -k3
+grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
+

这个时候真的懵了,不知道从何入手了,难道是linux操作系统方面的问题?

5.2 [gperftools](https://github.com/gperftools/gperftools)open in new window

起初,在网上看到有人说是因为linux自带的glibc版本太低了,导致的内存溢出,考虑一下。初步觉得也可能是因为这个问题,所以开始慢慢排查。oracle官方有一个jemalloc用来替换linux自带的,谷歌那边也有一个tcmalloc,据说性能比glibc、jemalloc都强,开始换一下。
根据网上说的,在容器里装libunwind,然后再装perf-tools,然后各种捣鼓,到最后发现,执行不了,

pprof --text /usr/bin/java java_58.0001.heap
+

看着工具高大上的,似乎能找出linux的调用栈,

6. 意外的结果

毫无头绪的时候,回想到了linux的top命令以及日志情况,测试环境是由于太多执行端业务方都没有维护,导致调度系统一直会出错,一出错就会导致大量刷错误日志,平均一天一个容器大概就有3G的日志,cron一旦到准点,就会有大量的任务要同时执行,而且容器中是做了对io的限制,磁盘也限制为10G,导致大量的日志都堆积在buff/cache里面,最终直接内存一直在涨,这个时候,系统不会挂,但是先会一直显示内存使用率达到100%。
修复后的结果如下图所示:

总结

定时调度这个系统当时并没有考虑到公司的系统会用的这么多,设计的时候也仅仅是为了实现上千的量,没想到到最后变成了一天的调度都有几百万次。最初那批开发也就使用了大量的本地缓存map来临时存储数据,然后面向简历编程各种用netty自己实现了通信的方式,一堆坑都留给了后人。目前也算是解决掉了一个由于线程过多导致系统不可用的情况而已,但是由于存在大量的map,系统还是得偶尔重启一下比较好。

参考:
1.记一次线上内存泄漏问题的排查过程open in new window
2.Java堆外内存增长问题排查Caseopen in new window
3.Troubleshooting Native Memory Leaks in Java Applicationsopen in new window

+ + + diff --git "a/java/\345\206\205\345\255\230\345\261\217\351\232\234.html" "b/java/\345\206\205\345\255\230\345\261\217\351\232\234.html" new file mode 100644 index 00000000..0094c5db --- /dev/null +++ "b/java/\345\206\205\345\255\230\345\261\217\351\232\234.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 内存屏障 | 个人博客 + + + + + +
跳至主要內容

内存屏障

Zephery约 208 字小于 1 分钟

内存屏障

四个内存屏障指令:LoadLoad,StoreStore,LoadStore,StoreLoad

在每个volatile写操作前插入StoreStore屏障,这样就能让其他线程修改A变量后,把修改的值对当前线程可见,在写操作后插入StoreLoad屏障,这样就能让其他线程获取A变量的时候,能够获取到已经被当前线程修改的值

在每个volatile读操作前插入LoadLoad屏障,这样就能让当前线程获取A变量的时候,保证其他线程也都能获取到相同的值,这样所有的线程读取的数据就一样了,在读操作后插入LoadStore屏障;这样就能让当前线程在其他线程修改A变量的值之前,获取到主内存里面A变量的的值。

+ + + diff --git "a/java/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html" "b/java/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html" new file mode 100644 index 00000000..774b7b66 --- /dev/null +++ "b/java/\345\234\250 Spring 6 \344\270\255\344\275\277\347\224\250\350\231\232\346\213\237\347\272\277\347\250\213.html" @@ -0,0 +1,105 @@ + + + + + + + + + + 在 Spring 6 中使用虚拟线程 | 个人博客 + + + + + +
跳至主要內容

在 Spring 6 中使用虚拟线程

Zephery约 1442 字大约 5 分钟

在 Spring 6 中使用虚拟线程

一、简介

在这个简短的教程中,我们将了解如何在 Spring Boot 应用程序中利用虚拟线程的强大功能。

虚拟线程是Java 19 的预览功能open in new window,这意味着它们将在未来 12 个月内包含在官方 JDK 版本中。Spring 6 版本open in new window最初由 Project Loom 引入,为开发人员提供了开始尝试这一出色功能的选项。

首先,我们将看到“平台线程”和“虚拟线程”之间的主要区别。接下来,我们将使用虚拟线程从头开始构建一个 Spring-Boot 应用程序。最后,我们将创建一个小型测试套件,以查看简单 Web 应用程序吞吐量的最终改进。

二、 虚拟线程与平台线程

主要区别在于虚拟线程open in new window在其操作周期中不依赖于操作系统线程:它们与硬件解耦,因此有了“虚拟”这个词。这种解耦是由 JVM 提供的抽象层实现的。

对于本教程来说,必须了解虚拟线程的运行成本远低于平台线程。它们消耗的分配内存量要少得多。这就是为什么可以创建数百万个虚拟线程而不会出现内存不足问题,而不是使用标准平台(或内核)线程创建几百个虚拟线程。

从理论上讲,这赋予了开发人员一种超能力:无需依赖异步代码即可管理高度可扩展的应用程序。

三、在Spring 6中使用虚拟线程

从 Spring Framework 6(和 Spring Boot 3)开始,虚拟线程功能正式公开,但虚拟线程是Java 19 的预览功能。open in new window这意味着我们需要告诉 JVM 我们要在应用程序中启用它们。由于我们使用 Maven 来构建应用程序,因此我们希望确保在 pom.xml 中包含以下代码

<build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+                <source>19</source>
+                <target>19</target>
+                <compilerArgs>
+                    --enable-preview
+                </compilerArgs>
+            </configuration>
+        </plugin>
+    </plugins>
+</build>
+

从 Java 的角度来看,要使用 Apache Tomcat 和虚拟线程,我们需要一个带有几个 bean 的简单配置类:

@EnableAsync
+@Configuration
+@ConditionalOnProperty(
+  value = "spring.thread-executor",
+  havingValue = "virtual"
+)
+public class ThreadConfig {
+    @Bean
+    public AsyncTaskExecutor applicationTaskExecutor() {
+        return new TaskExecutorAdapter(Executors.newVirtualThreadPerTaskExecutor());
+    }
+
+    @Bean
+    public TomcatProtocolHandlerCustomizer<?> protocolHandlerVirtualThreadExecutorCustomizer() {
+        return protocolHandler -> {
+            protocolHandler.setExecutor(Executors.newVirtualThreadPerTaskExecutor());
+        };
+    }
+}
+

第一个 Spring Bean ApplicationTaskExecutor将取代标准的*ApplicationTaskExecutoropen in new window* ,提供为每个任务启动新虚拟线程的Executor。第二个 bean,名为ProtocolHandlerVirtualThreadExecutorCustomizer,将以相同的方式 自定义标准TomcatProtocolHandler 。open in new window我们还添加了注释@ConditionalOnProperty,open in new window**以通过切换application.yaml文件中配置属性的值来按需启用虚拟线程:

spring:
+    thread-executor: virtual
+    //...
+

我们来测试一下Spring Boot应用程序是否使用虚拟线程来处理Web请求调用。为此,我们需要构建一个简单的控制器来返回所需的信息:

@RestController
+@RequestMapping("/thread")
+public class ThreadController {
+    @GetMapping("/name")
+    public String getThreadName() {
+        return Thread.currentThread().toString();
+    }
+}
+

*Threadopen in new window*对象的toString *()*方法将返回我们需要的所有信息:线程 ID、线程名称、线程组和优先级。让我们通过一个curlopen in new window请求来访问这个端点:

$ curl -s http://localhost:8080/thread/name
+$ VirtualThread[#171]/runnable@ForkJoinPool-1-worker-4
+

正如我们所看到的,响应明确表示我们正在使用虚拟线程来处理此 Web 请求。换句话说,*Thread.currentThread()*调用返回虚拟线程类的实例。现在让我们通过简单但有效的负载测试来看看虚拟线程的有效性。

四、性能比较

对于此负载测试,我们将使用JMeteropen in new window。这不是虚拟线程和标准线程之间的完整性能比较,而是我们可以使用不同参数构建其他测试的起点。

在这种特殊的场景中,我们将调用Rest Controller中的一个端点,该端点将简单地让执行休眠一秒钟,模拟复杂的异步任务:

@RestController
+@RequestMapping("/load")
+public class LoadTestController {
+
+    private static final Logger LOG = LoggerFactory.getLogger(LoadTestController.class);
+
+    @GetMapping
+    public void doSomething() throws InterruptedException {
+        LOG.info("hey, I'm doing something");
+        Thread.sleep(1000);
+    }
+}
+

请记住,由于*@ConditionalOnProperty* 注释,我们只需更改 application.yaml 中变量的值即可在虚拟线程和标准线程之间切换

JMeter 测试将仅包含一个线程组,模拟 1000 个并发用户访问*/load* 端点 100 秒:

image-20230827193431807
image-20230827193431807

在本例中,采用这一新功能所带来的性能提升是显而易见的。让我们比较不同实现的“响应时间图”。这是标准线程的响应图。我们可以看到,立即完成一次调用所需的时间达到 5000 毫秒:

image-20230827193511176
image-20230827193511176

发生这种情况是因为平台线程是一种有限的资源,当所有计划的和池化的线程都忙时,Spring 应用程序除了将请求搁置直到一个线程空闲之外别无选择。

让我们看看虚拟线程会发生什么:

image-20230827193533565
image-20230827193533565

正如我们所看到的,响应稳定在 1000 毫秒。虚拟线程在请求后立即创建和使用,因为从资源的角度来看它们非常便宜。在本例中,我们正在比较 spring 默认固定标准线程池(默认为 200)和 spring 默认无界虚拟线程池的使用情况。

**这种性能提升之所以可能,是因为场景过于简单,并且没有考虑 Spring Boot 应用程序可以执行的全部操作。**从底层操作系统基础设施中采用这种抽象可能是有好处的,但并非在所有情况下都是如此。

+ + + diff --git "a/java/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html" "b/java/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html" new file mode 100644 index 00000000..11e2d85e --- /dev/null +++ "b/java/\345\237\272\344\272\216kubernetes\347\232\204\345\210\206\345\270\203\345\274\217\351\231\220\346\265\201.html" @@ -0,0 +1,99 @@ + + + + + + + + + + 基于kubernetes的分布式限流 | 个人博客 + + + + + +
跳至主要內容

基于kubernetes的分布式限流

Zephery约 2145 字大约 7 分钟

基于kubernetes的分布式限流

做为一个数据上报系统,随着接入量越来越大,由于 API 接口无法控制调用方的行为,因此当遇到瞬时请求量激增时,会导致接口占用过多服务器资源,使得其他请求响应速度降低或是超时,更有甚者可能导致服务器宕机。

一、概念

限流(Ratelimiting)指对应用服务的请求进行限制,例如某一接口的请求限制为 100 个每秒,对超过限制的请求则进行快速失败或丢弃。

1.1 使用场景

限流可以应对:

  • 热点业务带来的突发请求;
  • 调用方 bug 导致的突发请求;
  • 恶意攻击请求。

1.2 维度

对于限流场景,一般需要考虑两个维度的信息:
时间
限流基于某段时间范围或者某个时间点,也就是我们常说的“时间窗口”,比如对每分钟、每秒钟的时间窗口做限定
资源
基于可用资源的限制,比如设定最大访问次数,或最高可用连接数。
  限流就是在某个时间窗口对资源访问做限制,比如设定每秒最多100个访问请求。

image.png
image.png

1.3 分布式限流

分布式限流相比于单机限流,只是把限流频次分配到各个节点中,比如限制某个服务访问100qps,如果有10个节点,那么每个节点理论上能够平均被访问10次,如果超过了则进行频率限制。

二、分布式限流常用方案

基于Guava的客户端限流
Guava是一个客户端组件,在其多线程模块下提供了以RateLimiter为首的几个限流支持类。它只能对“当前”服务进行限流,即它不属于分布式限流的解决方案。

网关层限流
服务网关,作为整个分布式链路中的第一道关卡,承接了所有用户来访请求。我们在网关层进行限流,就可以达到了整体限流的目的了。目前,主流的网关层有以软件为代表的Nginx,还有Spring Cloud中的Gateway和Zuul这类网关层组件,也有以硬件为代表的F5。

中间件限流
将限流信息存储在分布式环境中某个中间件里(比如Redis缓存),每个组件都可以从这里获取到当前时刻的流量统计,从而决定是拒绝服务还是放行流量。

限流组件
目前也有一些开源组件提供了限流的功能,比如Sentinel就是一个不错的选择。Sentinel是阿里出品的开源组件,并且包含在了Spring Cloud Alibaba组件库中。Hystrix也具有限流的功能。

Guava的Ratelimiter设计实现相当不错,可惜只能支持单机,网关层限流如果是单机则不太满足高可用,并且分布式网关的话还是需要依赖中间件限流,而redis之类的网络通信需要占用一小部分的网络消耗。阿里的Sentinel也是同理,底层使用的是redis或者zookeeper,每次访问都需要调用一次redis或者zk的接口。那么在云原生场景下,我们有没有什么更好的办法呢?

对于极致追求高性能的服务不需要考虑熔断、降级来说,是需要尽量减少网络之间的IO,那么是否可以通过一个总限频然后分配到具体的单机里面去,在单机中实现平均的限流,比如限制某个ip的qps为100,服务总共有10个节点,那么平均到每个服务里就是10qps,此时就可以通过guava的ratelimiter来实现了,甚至说如果服务的节点动态调整,单个服务的qps也能动态调整。

三、基于kubernetes的分布式限流

在Spring Boot应用中,定义一个filter,获取请求参数里的key(ip、userId等),然后根据key来获取rateLimiter,其中,rateLimiter的创建由数据库定义的限频数和副本数来判断,最后,再通过rateLimiter.tryAcquire来判断是否可以通过。

企业微信截图_868136b4-f9e2-4813-bc02-281a66756ecd.png
企业微信截图_868136b4-f9e2-4813-bc02-281a66756ecd.png

3.1 kubernetes中的副本数

在实际的服务中,数据上报服务一般无法确定客户端的上报时间、上报量,特别是对于这种要求高性能,服务一般都会用到HPA来实现动态扩缩容,所以,需要去间隔一段时间去获取服务的副本数。

func CountDeploymentSize(namespace string, deploymentName string) *int32 {
+	deployment, err := client.AppsV1().Deployments(namespace).Get(context.TODO(), deploymentName, metav1.GetOptions{})
+	if err != nil {
+		return nil
+	}
+	return deployment.Spec.Replicas
+}
+

用法:GET host/namespaces/test/deployments/k8s-rest-api直接即可。

3.2 rateLimiter的创建

在RateLimiterService中定义一个LoadingCache<String, RateLimiter>,其中,key可以为ip、userId等,并且,在多线程的情况下,使用refreshAfterWrite只阻塞加载数据的线程,其他线程则返回旧数据,极致发挥缓存的作用。

private final LoadingCache<String, RateLimiter> loadingCache = Caffeine.newBuilder()
+        .maximumSize(10_000)
+        .refreshAfterWrite(20, TimeUnit.MINUTES)
+        .build(this::createRateLimit);
+//定义一个默认最小的QPS
+private static final Integer minQpsLimit = 3000;
+

之后是创建rateLimiter,获取总限频数totalLimit和副本数replicas,之后是自己所需的逻辑判断,可以根据totalLimit和replicas的情况来进行qps的限定。

public RateLimiter createRateLimit(String key) {
+    log.info("createRateLimit,key:{}", key);
+    int totalLimit = 获取总限频数,可以在数据库中定义
+    Integer replicas = kubernetesService.getDeploymentReplicas();
+    RateLimiter rateLimiter;
+    if (totalLimit > 0 && replicas == null) {
+        rateLimiter = RateLimiter.create(totalLimit);
+    } else if (totalLimit > 0) {
+        int nodeQpsLimit = totalLimit / replicas;
+        rateLimiter = RateLimiter.create(nodeQpsLimit > minQpsLimit ? nodeQpsLimit : minQpsLimit);
+    } else {
+        rateLimiter = RateLimiter.create(minQpsLimit);
+    }
+    log.info("create rateLimiter success,key:{},rateLimiter:{}", key, rateLimiter);
+    return rateLimiter;
+}
+

3.3 rateLimiter的获取

根据key获取RateLimiter,如果有特殊需求的话,需要判断key不存在的尝尽

public RateLimiter getRateLimiter(String key) {
+  return loadingCache.get(key);
+}
+

3.4 filter里的判断

最后一步,就是使用rateLimiter来进行限流,如果rateLimiter.tryAcquire()为true,则进行filterChain.doFilter(request, response),如果为false,则返回HttpStatus.TOO_MANY_REQUESTS

public class RateLimiterFilter implements Filter {
+    @Resource
+    private RateLimiterService rateLimiterService;
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+        String key = httpServletRequest.getHeader("key");
+        RateLimiter rateLimiter = rateLimiterService.getRateLimiter(key);
+        if (rateLimiter != null) {
+            if (rateLimiter.tryAcquire()) {
+                filterChain.doFilter(request, response);
+            } else {
+                httpServletResponse.setStatus(HttpStatus.TOO_MANY_REQUESTS.value());
+            }
+        } else {
+            filterChain.doFilter(request, response);
+        }
+    }
+}
+

四、性能压测

为了方便对比性能之间的差距,我们在本地单机做了下列测试,其中,总限频都设置为3万。

无限流

企业微信截图_ea1b7815-3b89-43bf-aed7-240e135bdad1.png
企业微信截图_ea1b7815-3b89-43bf-aed7-240e135bdad1.png

使用redis限流

其中,ping redis大概6-7ms左右,对应的,每次请求需要访问redis,时延都有大概6-7ms,性能下降明显

企业微信截图_9118c4e0-c7f3-4e74-9649-4cd4d56fda79.png
企业微信截图_9118c4e0-c7f3-4e74-9649-4cd4d56fda79.png

自研限流

性能几乎追平无限流的场景,guava的rateLimiter确实表现卓越

企业微信截图_9f6510bd-be9e-438b-aa9d-bdd13ebca953.png
企业微信截图_9f6510bd-be9e-438b-aa9d-bdd13ebca953.png

五、其他问题

5.1 对于保证qps限频准确的时候,应该怎么解决呢?

在k8s中,服务是动态扩缩容的,相应的,每个节点应该都要有所变化,如果对外宣称限频100qps,而且后续业务方真的要求百分百准确,只能把LoadingCache<String, RateLimiter>的过期时间调小一点,让它能够近实时的更新单节点的qps。这里还需要考虑一下k8s的压力,因为每次都要获取副本数,这里也是需要做缓存的

5.2 服务从1个节点动态扩为4个节点,这个时候新节点识别为4,但其实有些并没有启动完,会不会造成某个节点承受了太大的压力

理论上是存在这个可能的,这个时候需要考虑一下初始的副本数的,扩缩容不能一蹴而就,一下子从1变为4变为几十个这种。一般的话,生产环境肯定是不能只有一个节点,并且要考虑扩缩容的话,至于要有多个副本预备的

5.3 如果有多个副本,怎么保证请求是均匀的

这个是依赖于k8s的service负载均衡策略的,这个我们之前做过实验,流量确实是能够均匀的落到节点上的。还有就是,我们整个限流都是基于k8s的,如果k8s出现问题,那就是整个集群所有服务都有可能出现问题了。

参考

1.常见的分布式限流解决方案open in new window
2.分布式服务限流实战open in new window
3.高性能open in new window

+ + + diff --git a/kafka/index.html b/kafka/index.html new file mode 100644 index 00000000..827b1779 --- /dev/null +++ b/kafka/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/kubernetes/index.html b/kubernetes/index.html new file mode 100644 index 00000000..70c20e52 --- /dev/null +++ b/kubernetes/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/kubernetes/spark on k8s operator.html b/kubernetes/spark on k8s operator.html new file mode 100644 index 00000000..3eb1c1a1 --- /dev/null +++ b/kubernetes/spark on k8s operator.html @@ -0,0 +1,118 @@ + + + + + + + + + + spark on k8s operator | 个人博客 + + + + + +
跳至主要內容

spark on k8s operator

Zephery约 1050 字大约 4 分钟

spark on k8s operator

Spark operator是一个管理Kubernetes上的Apache Spark应用程序生命周期的operator,旨在像在Kubernetes上运行其他工作负载一样简单的指定和运行spark应用程序。

使用Spark Operator管理Spark应用,能更好的利用Kubernetes原生能力控制和管理Spark应用的生命周期,包括应用状态监控、日志获取、应用运行控制等,弥补Spark on Kubernetes方案在集成Kubernetes上与其他类型的负载之间存在的差距。

Spark Operator包括如下几个组件:

  1. SparkApplication控制器:该控制器用于创建、更新、删除SparkApplication对象,同时控制器还会监控相应的事件,执行相应的动作。
  2. Submission Runner:负责调用spark-submit提交Spark作业,作业提交的流程完全复用Spark on K8s的模式。
  3. Spark Pod Monitor:监控Spark作业相关Pod的状态,并同步到控制器中。
  4. Mutating Admission Webhook:可选模块,基于注解来实现Driver/Executor Pod的一些定制化需求。
  5. SparkCtl:用于和Spark Operator交互的命令行工具。

安装

# 添加源
+helm repo add spark-operator https://googlecloudplatform.github.io/spark-on-k8s-operator
+# 安装
+helm install my-release spark-operator/spark-operator --namespace spark-operator --create-namespace
+

这个时候如果直接执行kubectl apply -f examples/spark-pi.yaml调用样例,会出现以下报错,需要创建对象的serviceaccount。

forbidden: error looking up service account default/spark: serviceaccount \"spark\" not found.\n\tat io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:568)\n\tat io.fabric8.kubernetes.client.dsl.base.OperationSupport
+

同时也要安装rbac

rbac的文件在manifest/spark-operator-install/spark-operator-rbac.yaml,需要把namespace全部改为需要运行的namespace,这里我们任务放在default命名空间下,所以全部改为default,源文件见rbac.yamlopen in new window

执行脚本,这里用的app.jar是一个读取es数据源,然后计算,为了展示效果,在程序的后面用了TimeUnit.HOURS.sleep(1)方便观察。

代码如下:

 SparkConf sparkConf = new SparkConf().setAppName("Spark WordCount Application (java)");
+        sparkConf.set("es.nodes", "xxx")
+                .set("es.port", "8xx0")
+                .set("es.nodes.wan.only", "true")
+                .set("es.net.http.auth.user", "xxx")
+                .set("es.net.http.auth.pass", "xxx-xxx");
+        try (JavaSparkContext jsc = new JavaSparkContext(sparkConf)) {
+            JavaRDD<Map<String, Object>> esRDD = JavaEsSpark.esRDD(jsc, "kibana_sample_data_ecommerce").values();
+
+            System.out.println(esRDD.partitions().size());
+
+            esRDD.map(x -> x.get("customer_full_name"))
+                    .countByValue()
+                    .forEach((x, y) -> System.out.println(x + ":" + y));
+            TimeUnit.HOURS.sleep(1);
+
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+

打包之后kubectl create -f k8s.yaml即可

apiVersion: "sparkoperator.k8s.io/v1beta2"
+kind: SparkApplication
+metadata:
+  name: spark-demo
+  namespace: default
+spec:
+  type: Scala
+  mode: cluster
+  image: fewfew-docker.pkg.coding.net/spark-java-demo/spark-java-demo-new/spark-java-demo:master-1d8c164bced70a1c66837ea5c0180c61dfb48ac3
+  imagePullPolicy: Always
+  mainClass: com.spark.es.demo.EsReadGroupByName
+  mainApplicationFile: "local:///opt/spark/examples/jars/app.jar"
+  sparkVersion: "3.1.1"
+  restartPolicy:
+    type: Never
+  driver:
+    # 用cores必须要大于等于1,这里用coreRequest
+    coreRequest: "100m"
+    coreLimit: "1200m"
+    memory: "512m"
+    labels:
+      version: 3.1.1
+    serviceAccount: sparkoperator
+  executor:
+    # 用cores必须要大于等于1,这里用coreRequest
+    coreRequest: "100m"
+    instances: 1
+    memory: "512m"
+    labels:
+      version: 3.1.1
+
spark-demo-driver                                          1/1     Running   0          2m30s
+spark-wordcount-application-java-0ac352810a9728e1-exec-1   1/1     Running   0          2m1s
+

同时会自动生成相应的service。

image-20220528203941897
image-20220528203941897
image-20220528203816649

Spark on k8s operator大大减少了spark的部署与运维成本,用容器的调度来替换掉yarn,

源码解析

architecture-diagram

Spark Operator的主要组件如下:

1、SparkApplication Controller : 用于监控并相应SparkApplication的相关对象的创建、更新和删除事件;

2、Submission Runner:用于接收Controller的提交指令,并通过spark-submit 来提交Spark作业到K8S集群并创建Driver Pod,driver正常运行之后将启动Executor Pod;

3、Spark Pod Monitor:实时监控Spark作业相关Pod(Driver、Executor)的运行状态,并将这些状态信息同步到Controller ;

4、Mutating Admission Webhook:可选模块,但是在Spark Operator中基本上所有的有关Spark pod在Kubernetes上的定制化功能都需要使用到该模块,因此建议将enableWebhook这个选项设置为true。

5、sparkctl: 基于Spark Operator的情况下可以不再使用kubectl来管理Spark作业了,而是采用Spark Operator专用的作业管理工具sparkctl,该工具功能较kubectl功能更为强大、方便易用。

image-20220612194403742

apis:用户编写yaml时的解析

Batchscheduler:批处理的调度,提供了支持volcano的接口

Client:

leader的选举

electionCfg := leaderelection.LeaderElectionConfig{
+   Lock:          resourceLock,
+   LeaseDuration: *leaderElectionLeaseDuration,
+   RenewDeadline: *leaderElectionRenewDeadline,
+   RetryPeriod:   *leaderElectionRetryPeriod,
+   Callbacks: leaderelection.LeaderCallbacks{
+      OnStartedLeading: func(c context.Context) {
+         close(startCh)
+      },
+      OnStoppedLeading: func() {
+         close(stopCh)
+      },
+   },
+}
+
+elector, err := leaderelection.NewLeaderElector(electionCfg)
+

参考:

1.k8s client-go中Leader选举实现open in new window

2.[Kubernetes基于leaderelection选举策略实现组件高可用open in new window

+ + + diff --git a/life/2017.html b/life/2017.html new file mode 100644 index 00000000..e87eb370 --- /dev/null +++ b/life/2017.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + +
跳至主要內容

Zephery约 3365 字大约 11 分钟

2016年6月,大三,考完最后一科,默默的看着大四那群人一个一个的走了,想着想着,明年毕业的时候,自己将会失去你所拥有的一切,大学那群认识的人,可能这辈子都不会见到了——致远离家乡出省读书的娃。然而,我并没有想到,自己失去的,不仅仅是那群人,几乎是一切。。。。
17年1月,因为受不了北京雾霾(其实是次因),从实习的公司跑路了,很不舍,只是,感觉自己还有很多事要做,很多梦想要去实现,毕竟,看着身边的人,去了美团,拿着15k的月薪,有点不平衡,感觉他也不是很厉害吧,我努力努力10k应该没问题吧?

回到学校,待了几天,那个整天给别人灌毒鸡汤的人还是不着急找工作:该有的时候总会有的啦,然后继续打游戏、那个天天喊着吃麻辣香锅的人,记忆中好像今年都没有吃上,哈哈、厕所还是那样偶尔炸一下,嗯,感觉一切都很熟悉,只是,我有了点伤感,毕竟身边又要换一群不认识的人了。考完试,终于能回广东了,一年没回了,开心不得了,更多的是,为了那个喜欢了好几年没有表白的妹纸,之前从没想过真的能每天跟一个妹纸道晚安,秒回,但是,对她,我还真做到了。1月份的广州,不热不冷,空气很清新,比北京、天津那股泥土味好多了,只是,我被拒了,男闺蜜还是男闺蜜,备胎还是备胎,那会还没想过放弃,直到...

春节期间,把自己的网站open in new window整理了一下,看了看JVM和并发的知识,偶尔刷刷牛客网的题,觉得自己没多大问题了,跟同学出发,去深圳,我并没有一个做马化腾、马云的梦,但是我想,要做出点东西,至少,不是个平庸的人。投了几个,第一个面试,知道是培训兼外包后果断弃了,春招还没开始,再多准备准备,有时间就往深圳图书馆里跑,找个位置,静静的复习,那会,感觉自己一定能去个大公司吧,搞搞分布式、大数据之类的~

疲惫的面试历程

2月份底开始慢慢投简历,跑招聘会,深圳招聘的太少了,那就去广州,大学城,于是,开始了自己一周两天都在广深往返。有的公司笔试要跑一次广州,一面要跑一次,二面还要跑一次,每次看着路费,真的承受不起,但是有希望就行。乐观之下,到来的是一重又一重的打击。

**数码,很看好的公司,在广州也算是老品牌了,笔试的时候面试官没有带够卷子,就拿了大数据的做,还过了,面试的时候被面到union和union all的区别,答反了,还有left join和right join的原理,一脸懵逼,过后去了百度搜了搜,这东西哪来的原理?

然后是个企业建站的,笔试完了,面试官照着题问然后没说啥就让我走了,额,我好像还没自我介绍呢。

有点想回北京了,往北京投了一份,A轮公司,月薪10k,过了,觉得自己技术应该不差吧,不过还是拒了,因为一想起那里满脑子都是雾霾。

没事没事,下一家,某游戏公司,笔试过了,一面也过了,然后被问flume收集的时候断网处理机制、MD5和RSA原理、Angulajs和Vuejs用没用过、千万级的数据是如何存储的?额,跟你们想的一样,我一道也答出来,然后就挂了,面试官跟我说,你要是来早三个月这些都会啦,说的我很紧张,广东的同学都那么强么?

这个时候还没质疑自己的技术,去了趟深圳某家小公司,金融的,HR问我是不是培训过来的,心里开始突然间好苦涩,大学花那么多时间学习居然被别人用来和培训机构的人相提并论,笔试不知从哪整来的英文逻辑题,做完了然后上机笔试,做不出来不能见面试官,开始感觉这公司有点。。。。还是撤了撤了。

突然感觉面试面的绝望,是自己的问题么?是自己技术太菜了么?开始怀疑自己,感觉也是,已经3月份底了,毕竟别人都在实习,而我已经离职3个月没工作了,但是那些问题不是有点离谱了,一开始是开始心态爆炸觉得怎么可以对应届生问这些问题,不应该是基础么?算法什么的,后来是无奈了,开始上网搜各种不沾边的技术。

还有其他的面试。。。有的工资不高(6K不到),有的面试问题全答对就因为说了有点想做大数据就不要你,有的聊得很欢快却没消息,有的说招java但是笔试一道java题都没有全是前端的,有的打着互联网实际却是外包的公司。。。。
  4月初真的很绝望很绝望,不想跟别人说话,是不是很可笑,一个从北京B+轮的公司回广东,面试近15个,居然只能拿到2个offer,其中之一国企外包的,都不知说什么好。13号要拍毕业照了,没有回去,大学四年,毕竟大家个个圈子之间没什么交流,没什么友谊,果然,整个专业的人只有2/3的人去拍了毕业照。4月23号,拉勾网深圳站,梦想着市集,抱着一点点的小希望,去投了5个,结果一个面试邀请都没有,换之而来的是一片绝望、黑暗。。。。

感情、我们毕业了

5月初回学校了赶毕业设计,回学校也是,天天往图书馆跑,为了面试,毕业设计拉下太多了。悠闲的时候,总会想起我喜欢的那个人,过的怎么样了,微信一开,好像自己被屏蔽了还是被删了?这三个月来的面试打击,真的不知道怎么应对,我更不知道怎么跟她聊天,以至于慢慢隔离,这段感情,或许只有我知道自己有多心疼,只有我自己sb得一点点的呵护着。想起上次跟她聊天是4月中,还是她提了个问题其他什么都没问,彼此之前已经没有关心了。删了吧删了吧,就这样一句再见都没有说,一句“祝福”都没有说。
  5月底遇到两次还算开心的事,导师问我要不要评优秀论文,不是很想折腾,拒了,导师仍旧劝我,只是写个3页的小总结而已,评上的话能留图书馆收藏。另一个件是珍爱网打电话过来说我一面过了,什么时候二面,天啊,3月份一面,5月底才通知,心里想骂,但是真的好开心好开心,黑暗中的光芒,泪奔。。。。约到了6月15号面试。
  6月初开始自己的回家倒计时,请那唯一一个跟我好的妹纸吃饭,忙完答辩,然后是优秀论文的小报告,13号下午交了上去,再回到宿舍,空无一人,一遍忍着不要悲伤,一遍收拾东西,然后向每个宿舍敲门,告别,一个人拖着行李箱,嗯,我要淡定。

准备了有点久,我以为自己准备好了,15号,深圳,珍爱网,被问到:有没有JVM调优经验?ZK是如何保持一致性的?有没有写过ELK索引经验?谈谈你对dubbo的理解。。。事后,得知自己没有过。心态真的炸了,通宵打了两天游戏。月底得知,优秀论文也没有被评上,已经没有骂人吐槽的想法,只是哦的一声,6月,宣告了自己春招结束,宣告自己要去外包,同时也宣告自己大学这些努力全部白费,跟那个灌毒鸡汤天天打游戏的人同一起跑线。

996的工作

七月初入职的时候,问了问那些一起应届入职的同学,跟别人交流一下面试被问的问题,只有线程池,JVM回收算法,他们也没用过,我无奈,为什么我被问到的,全是Angularjs、MD5加密算法、ZK一致性原理这种奇葩的问题。。。。。

没有环境,就自己创造,下班有时间就改改自己的网站http://www.wenzhihuai.comopen in new window,GitHub目前有154个star了,感觉也是个小作品吧,把常用的Java技术栈(RabbitMQ、MongoDB等)加了上去,虽然没啥使用场景,但是自己好好努力吧,毕竟高并发、高可用是自己的梦想。今年GitHub自己的提交次数。

决心先好好呆着,学习学习,把公司的产品业务技术专研专研,7、8月份是挺开心的,没怎么加班,虽然下班我都留在公司学习,虽然公司的产品不咋地,但是还是有可学之处的,随后,我没想到的是,公司要实行996,,,9月份至12月,每天都是改bug,开发模块,写业务,全都是增删改查,没有涉及redis、rabbitmq,就真的只有使用Hibernate、spring,而做出的东西,要使用JDK6来运行,至今都能看到sun的类。每天的状态就是累累累,我们组还不是最惨的,隔壁项目组,一周通宵两次,9月到10都是如此,国庆加班,每次经过他们组,我都觉得自己还算是幸福。很厌恶这种不把员工当人看的行为,有同事调侃,明年估计我们这些应届过来的,是不是要走掉2/3的人?疯狂加班的代价是牺牲积极性,我问过那些一周通宵两次的人,敲代码,程序员你喜欢这份工作么?不喜欢!!!有那么一两次,实在是太累了,我都感觉自己有点不行了,想离职,可是,会有公司要我么?会有公司不问那些奇葩的问题么?

双十一,花了500多买了十本书,神书啊,计算机届的圣经啊,然而至今一本都没看完,甚至是都没怎么翻,每天下班回去之后就是9点半了,烧水,洗澡,洗衣服,近11点了,躺床上,一遍看书一遍看鹌鹑直播,一小时才翻几页,996真的太累了,实在看不下书。经过这几个月的加班,感觉自己技术增长为负数,也病了几次,同学见我,都感觉我老了不少,心里不平,可是又没有什么办法。

孤独

珠江新城,一年四季都那么美,今晚应该又是万人一起倒计时了吧?已经好久没跟别人一起出去玩过了。今年貌似得了自闭症?社交全靠黄段子。想找人出门走走,然而手机已经没有那种几年的朋友,大学同学一个都不在,哈哈哈,别人说社交软件让人离得更近,我怎么发现我自己一个好朋友都没有了呢,哭笑ing。或许是自己的确不善于跟别人保持联系吧,这个要改,一定要改!!!
远看:

近看:

题外话:
有些时候,遇到不顺,感觉自己不是神,没必要忍住,就开始宣泄自己的情绪,比如疯狂打游戏,只能这样度过了吧。
今年听过最多的一句话,你好厉害,你好牛逼==我感觉也是,可惜,要被业务耽误了不少时间吧。。
《企业IT架构转型之道》是今年最好的架构图书,没有之一。

期望

想起初中,老师让我在黑板写自己的英文作文,好像是信件,描述什么状况来这?最后夸了夸我在文章后面加的一段大概是劝别人不要悲伤要灿烂。也想起一个故事,二战以后,德国满目疮痍,他们处在这样一个凄惨的境地,还能想到在桌上摆设一些花,就一定能在废墟上重建家园。我所看到的是即使在再黑暗的状态下,要永远抱着希望。明年要更加努力的学习,而不是工作,是该挽留一些人了,多运动。说了那么多,其实,我只希望自己的运气不要再差了,再差就没法活了。人在遇到不顺的时候,往往最难过的一关便是自己。哈哈哈,只能学我那个同学给自己灌毒鸡汤了。加油加油↖(^ω^)↗

+ + + diff --git a/life/2018.html b/life/2018.html new file mode 100644 index 00000000..58030fb9 --- /dev/null +++ b/life/2018.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + +
跳至主要內容

Zephery约 1305 字大约 4 分钟

年底老姐结婚,跑回家去了,忙着一直没写,本来想回深圳的时候空余的时候写写,没想到一直加班,嗯,9点半下班那种,偶尔也趁着间隙的时间,一段一段的凑着吧。

想着17年12月31号写的那篇文章https://www.cnblogs.com/w1570631036/p/8158284.htmlopen in new window,感叹18年还算恢复了点。

心惊胆战的裸辞经历

其实校招过去的那家公司,真的不是很喜欢,996、技术差、产品差,实在受不了,春节前提出了离职,老大也挽留了下,以“来了个阿里的带我们重构,能学不了东西”来挽留,虽然我对技术比较痴迷,但离职去深圳的决心还是没有动摇,嗯,就这么开始了自己的裸辞过程。3月8号拿到离职,回公司的时候跟跟同事吹吹水,吃个饭,某同事还喊:“周末来公司玩玩么,我给你开门”,哈哈哈,泼出去的水,回不去了,偶尔有点伤感。
去深圳面试,第一家随手记,之前超级想去这家公司的,金融这一块,有钱,只可惜,没过,一面面试官一直夸我,我觉得稳了,二面没转过来,就这么挂了,有点不甘心吧,在这,感谢那个内推我的人吧,面经在这open in new window,之后就是大大小小的面试,联想、恒大、期待金融什么的,都没拿到offer,裸辞真的慌得一比,一天没工作,感觉一年没有工作没人要的样子。。。。没面试就跑去广州图书馆,复习,反思,一天一天的过着,回家就去楼下吃烧烤,打游戏,2点3点才睡觉,boss直聘、拉勾网见一个问一个,迷迷糊糊慌慌张张,那段期间真的想有点把所有书卖掉回家啃老的想法,好在最后联系了一家公司,电商、大小周,知乎上全是差评,不过评价的都不是技术的,更重要的是,岗位是中间件的,嗯,去吧。

and ... 广州拜拜,晚上人少的时候,跟妹纸去珠江新城真的很美好

工作工作

入职的时候是做日志收集的,就是flume+kafka+es这一套,遇到了不少大佬,嗯,感觉挺好的,打算好好干,一个半月后不知怎么滴,被拉去做容器云了,然后就开始了天天调jenkins、gitlab这些没什么用的api,开始了增删改查的历程,很烦,研究jenkins、gitlab对于自己的技术没什么提升,又不得不做,而且大小周+加班这么做,回到家自己看java、netty、golang的书籍,可是没项目做没实践,过几个月就忘光了,有段时间真的很烦很烦,根本不想工作,天天调api,而且是jenkins、gitlab这些没什么卵用的api,至今也没找到什么办法。。。。
公司发展太快,也实在让人不知所措,一不小心部门被架空了,什么预兆都没有,被分到其他部门,然后发现这个部门领导内斗真的是,“三国争霸”吧,无奈成为炮灰,不同的领导不同的要求,安安静静敲个代码怎么这么难。。。。
去年的学习拉下了不少,文章也写的少了,总写那些入门的文章确实没有什么意思,买的书虽然没有17年的多吧,不过也不少了,也看了挺多本书的,虽然我还是不满意自己的阅读量。
这几年要开始抓准一个框架了,好好专研一下,也要开始学习一下go了,希望能参与一些github的项目,好好努力吧。

跑步跑步

平时没事总是宅在家里打游戏,差不多持续到下半年吧,那会打游戏去楼下吃东西的时候老是觉得眼神恍惚,盯着电子产品太多了,然后就跟别人跑步去了,每周去一次人才公园,跑步健身,人才公园真的是深圳跑步最好的一个地方了,桥上总有一群摄影师,好想在深圳湾买一套房子,看了看房价,算了算了,深圳的房,真的贵的离谱。19年也要多多运动,健康第一健康第一。

Others

  1. 拿到了深圳户口,全程只花了15天,感谢学妹and家人
  2. 买了第一台MacBook Pro,对于Java的我真心不好用
  3. 盼了好几年的老姐结婚,18年终于了解了这心事
  4. 养了只猫,在经历了好几个月的早起之后,晚上睡觉锁厨房,终于安分了,对不起了哈哈哈

2019

想不起来还有什么要说的了,毕竟程序员,好像每天的生活都一样,就展望一下19年吧。今年,最最重要的是家里人以及身边还有所有人都健健康康的,哈哈哈。然后是安安静静的敲代码~~就酱

+ + + diff --git a/life/2019.html b/life/2019.html new file mode 100644 index 00000000..425e4e2e --- /dev/null +++ b/life/2019.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + +
跳至主要內容

Zephery约 1328 字大约 4 分钟

2019,本命年,1字头开头的年份,就这么过去了,迎来了2开头的十年,12月过的不是很好,每隔几天就吵架,都没怎么想起写自己的年终总结了,对这个跨年也不是很重视,貌似有点浑浑噩噩的样子。今天1号,就继续来公司学习学习,就写写文章吧。
19年一月,没发生什么事,对老板也算是失望,打算过完春节就出去外面试试,完全的架构错误啊,怎么守得了,然后开了个年会,没什么好看的,唯一的例外就是看见漂漂亮亮的她,可惜不敢搭话,就这么的呗。2月以奇奇怪怪的方式走到了一起,开心,又有点伤心,然后就开始了这个欢喜而又悲剧的本命年。

工作

从18年底开始吧,大概就知道领导对容器云这么快的完全架构设计错误,就是一个完完全全错误的产品,其他人也觉得有点很有问题,但老板就是固执不听,结果一个跑路,一个被压得懒得反抗,然后我一个人跟老板和项目经理怼了前前后后半年,真是惨啊,还要被骂,各种拉到小黑屋里批斗,一直在对他们强调:没有这么做的!!!然后被以年轻人,不懂事,不要抱怨,长大了以后就领会了怼回来,当时气得真是无语。。。。。自己调研的阿里云、腾讯云、青云,还有其他小公司的容器,发现真的只有我们这么设计,完全错误的方向,,,,直到老板走了之后,才开始决定重构,走上正轨。

之后有了点起色,然后开始着重强调了DevOps的重要性,期初也没人理解,还被骂天天研究技术不干活。。。这东西没技术,但是真的是公司十分需要的公司好么!!可惜公司对这个产品很失望,也不给人,期间还说要暂停项目,唉,这么大的项目就给几个人怎么做,谁都不乐意,就这么过的很憋屈吧,开始了维护的日子。。。

工作上,蛮多人对我挺好的,领导,同事,不过有时候憋屈的时候还是有了点情绪化,有时候有点悲伤的想法,浮躁、暴躁,出去面试了几次,感觉不是自己能力不好,而是市场上的真的需要3+年以上的。。。。不过感觉自己能在这里憋屈的过了这么久,也是很佩服自己的,哈哈,用同事的话来说就是:当做游戏里的练级,锻炼自己哈哈哈

学习

项目的方向错误,导致自己写的代码都是很简单的增删改查,没有技术含量的那种,也最终导致自己浪费了不少时间,上半年算是很气愤吧,不想就这么浪费掉这些时间,虽然期间看了各种各样的东西,比如Netty、Go、操作系统什么的,最终发现,如果不在项目中使用的话,真的会忘,而且很快就忘掉,最后的还是决定学习项目相关度比较大的东西了,比如Go,如果项目不是很大,小项目的话,就用Go来写,这么做感觉提升还是挺大的。
过去一年往南山图书馆借了不少书,省了不少钱,虽然没怎么看,但我至少有个奋斗的心啊,哈哈哈哈哈哈哈哈,文章写得少了,因为感觉写不出好东西,总是入门的那种,不深,不值得学习,想想到时候把别人给坑了,也不好意思。
操作系统感觉还是要好好学学了,加油

Kubernetes就是未来的方向,有时候翻开源码看看,又不敢往下面看了,对底层不熟吧,今年要多多研究下Kubernetes的源码了,至于Spring那一套,也不知道该不该放弃,或者都学习一下?云原生就是趋势。

感情

吵架了,没心思写

运动

过去一年还是把运动算是坚持了下来,每个月必去深圳湾跑一次。还是没怎么睡好,工作感情上都有点不顺,加上自己本身就难以入睡,有时候躺床上就是怎么也睡不着,还长了痘痘,要跑去医院那种,可怕,老了,还是要早点睡觉,多走走多运动,好久没打羽毛球了,自己也不想有空的时候只会打游戏,今年继续加油,多运动吧。

还爬了两次南山

其他

看了周围蛮多同事去了腾讯阿里,有点心动,好想去csig,没到3年真的让人很抓狂。
过去一年过的蛮憋屈的,特别是工作不顺,加上跟女朋友吵架,心态爆炸。。。

2020展望

每年这个时候,都不敢有太大的期望了,祝大家都健健康康的,工作顺利!!

当然,如果有可能的话,我想去CSIG

+ + + diff --git a/life/index.html b/life/index.html new file mode 100644 index 00000000..52be33a0 --- /dev/null +++ b/life/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/logo.png b/logo.png new file mode 100644 index 00000000..19318875 Binary files /dev/null and b/logo.png differ diff --git a/logo.svg b/logo.svg new file mode 100644 index 00000000..d0df14c8 --- /dev/null +++ b/logo.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/open-source-project/index.html b/open-source-project/index.html new file mode 100644 index 00000000..22af228e --- /dev/null +++ b/open-source-project/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/others/chatgpt.html b/others/chatgpt.html new file mode 100644 index 00000000..f6d99943 --- /dev/null +++ b/others/chatgpt.html @@ -0,0 +1,155 @@ + + + + + + + + + + 微信公众号-chatgpt智能客服搭建 | 个人博客 + + + + + +
跳至主要內容

微信公众号-chatgpt智能客服搭建

Zephery约 2899 字大约 10 分钟

微信公众号-chatgpt智能客服搭建

想体验的可以去微信上搜索【旅行的树】公众号。

一、ChatGPT注册

1.1 短信手机号申请

openai提供服务的区域,美国最好,这个解决办法是搞个翻墙,或者买一台美国的服务器更好。

国外邮箱,hotmail或者google最好,qq邮箱可能会对这些平台进行邮件过滤。

国外手机号,没有的话也可以去https://sms-activate.orgopen in new window,费用大概需要1美元,这个网站记得也用国外邮箱注册,需要先充值,使用支付宝支付。

image-20230220172107296

之后再搜索框填openai进行下单购买即可。

img

1.2 云服务器申请

openai在国内不提供服务的,而且也通过ip识别是不是在国内,解决办法用vpn也行,或者,自己去买一台国外的服务器也行。我这里使用的是腾讯云轻量服务器,最低配置54元/月,选择windows的主要原因毕竟需要注册openai,需要看页面,同时也可以搭建nginx,当然,用ubuntu如果能自己搞界面也行。

image-20230221193455384

1.3 ChatGPT注册

购买完之后,就可以直接打开openai的官网了,然后去https://platform.openai.com/signup官网里注册,注册过程具体就不讲了,讲下核心问题——短信验证码open in new window

image-20230222104357230

然后回sms查看验证码。

image-20230222104225722

注册成功之后就可以在chatgpt里聊天啦,能够识别各种语言,发起多轮会话的时候,可能回出现访问超过限制什么的。

image-20230220173335691

通过chatgpt聊天不是我们最终想要的,我们需要的是在微信公众号也提供智能客服的聊天回复,所以我们需要在通过openai的api来进行调用。

image-20230222104316514

二、搭建nginx服务器

跟页面一样,OpenAI的调用也是不能再国内访问的,这里,我们使用同一台服务器来搭建nginx,还是保留使用windows吧,主要还是得注意下面这段话,如果API key被泄露了,OpenAI可能会自动重新更新你的API key,这个规则似乎是API key如果被多个ip使用,就会触发这个规则,调试阶段还是尽量使用windows的服务器吧,万一被更新了,还能去页面上重新找到。

Do not share your API key with others, or expose it in the browser or other client-side code. In order to protect the security of your account, OpenAI may also automatically rotate any API key that we've found has leaked publicly.
+

windows的安装过程参考网上的来,我们只需要添加下面这个配置即可,原理主要是将调用OpenAI的接口全部往官网转发。

    location /v1/completions {
+      proxy_pass https://api.openai.com/v1/completions;
+    }
+

然后使用下面的方法进行调试即可:

POST http://YOUR IP/v1/completions
+Authorization: Bearer YOUR_API_KEY
+Content-Type: application/json
+
+{
+  "model": "text-davinci-003",
+  "prompt": "Say this is a test",
+  "max_tokens": 7,
+  "temperature": 0
+}
+

三、公众号开发

网上有很多关于微信通过chatgpt回复的文章,有些使用自己微信号直接做为载体,因为要扫码网页登陆,而且是网页端在国外,很容易被封;有些是使用公众号,相对来说,公众号被封也不至于导致个人微信号出问题。

3.1 微信云托管

微信公众平台提供了微信云托管,无需鉴权,比其他方式都方便不少,可以免费试用3个月,继续薅羊毛,当然,如果自己开发能力足够,也可以自己从0开始开发。

image-20230220192603751

提供了各种语言的模版,方便快速开发,OpenAI官方提供的sdk是node和python,这里我们选择express(node)。

image-20230220201004069

3.2 一个简单ChatGPT简单回复

微信官方的源码在这,https://github.com/WeixinCloud/wxcloudrun-express,我们直接fork一份自己来开发。open in new window

一个简单的消息回复功能(无db),直接在我们的index.js里添加如下代码。

const configuration = new Configuration({
+    apiKey: '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',
+    basePath: 'http://43.153.15.174/v1'
+});
+const openai = new OpenAIApi(configuration);
+
+async function simpleResponse(prompt) {
+    const completion = await openai.createCompletion({
+        model: 'text-davinci-003',
+        prompt,
+        max_tokens: 1024,
+        temperature: 0.1,
+    });
+    const response = (completion?.data?.choices?.[0].text || 'AI 挂了').trim();
+    return strip(response, ['\n', 'A: ']);
+}
+
+app.post("/message/simple", async (req, res) => {
+    console.log('消息推送', req.body)
+    // 从 header 中取appid,如果 from-appid 不存在,则不是资源复用场景,可以直接传空字符串,使用环境所属账号发起云调用
+    const appid = req.headers['x-wx-from-appid'] || ''
+    const {ToUserName, FromUserName, MsgType, Content, CreateTime} = req.body
+    console.log('推送接收的账号', ToUserName, '创建时间', CreateTime)
+    if (MsgType === 'text') {
+        message = await simpleResponse(Content)
+        res.send({
+            ToUserName: FromUserName,
+            FromUserName: ToUserName,
+            CreateTime: CreateTime,
+            MsgType: 'text',
+            Content: message,
+        })
+    } else {
+        res.send('success')
+    }
+})
+

本地可以直接使用http请求测试,成功调用之后直接提交发布即可,在微信云托管上需要先授权代码库,即可使用云托管的流水线,一键发布。注意,api_base和api_key可以填写在服务设置-基础信息那里,一个是OPENAI_API_BASE,一个是OPENAI_API_KEY,服务会自动从环境变量里取。

3.3 服务部署

提交代码只github或者gitee都可以,值得注意的是,OpenAI判断key泄露的规则,不知道是不是判断调用的ip地址不一样,还是github的提交记录里含有这块,有点玄学,同样的key本地调用一次,然后在云托管也调用的话,OpenAI就很容易把key给重新更新。

image-20230220203313790

部署完之后,云托管也提供了云端调试功能,相当于在服务里发送了http请求。这一步很重要,如果没有调用成功,则无法进行云托管消息推送。

image-20230220203711436

这里填上你自己的url,我们这里配置的是/meesage/simple,如果没有成功,需要进行下面步骤进行排查:

(1)服务有没有正常启动,看日志

(2)端口有没有设置错误,这个很多次没有注意到

image-20230220203445297

保存成功之后,就可以在微信公众号里测试了。

image-20230221134250689

体验还可以

四、没有回复(超时回复问题)

很多OpenAI的回答都要几十秒,有的甚至更久,比如对chatgpt问“写一篇1000字关于深圳的文章”,就需要几十秒,而微信的主动回复接口,是需要我们3s内返回给用户。

订阅号的消息推送分几种:

  1. 被动消息回复:指用户给公众号发一条消息,系统接收到后,可以回复一条消息。
  2. 主动回复/客服消息:可以脱离被动消息的5秒超时权限,在48小时内可以主动回复。但需要公众号完成微信认证。

根据微信官方文档,没有认证的公众号是没有调用主动回复接口权限的,https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Explanation_of_interface_privileges.htmlopen in new window

image-20230221100251825

对于有微信认证的订阅号或者服务号,可以调用微信官方的/cgi-bin/message/custom/send接口来实现主动回复,但是对于个人的公众号,没有权限调用,只能尝试别的办法。想来想去,只能在3s内返回让用户重新复制发送的信息,同时后台里保存记录异步调用,用户重新发送的时候再从数据库里提取回复。

1.先往数据库存一条 回复记录,把用户的提问存下来,以便后续查询。设置回复的内容为空,设置状态为 回复中(thinking)。

  // 因为AI响应比较慢,容易超时,先插入一条记录,维持状态,待后续更新记录。
+  await Message.create({
+    fromUser: FromUserName,
+    response: '',
+    request: Content,
+    aiType: AI_TYPE_TEXT, // 为其他AI回复拓展,比如AI作画
+  });
+

2.抽象一个 chatGPT 请求方法 getAIMessage,函数内部得到 GPT 响应后,会更新之前那条记录(通过用户id & 用户提问 查询),把状态更新为 已回答(answered),并把回复内容更新上。

 // 成功后,更新记录
+  await Message.update(
+    {
+      response: response,
+      status: MESSAGE_STATUS_ANSWERED,
+    },
+    {
+      where: {
+        fromUser: FromUserName,
+        request: Content,
+      },
+    },
+  );
+

3.前置增加一些判断,当用户在请求时,如果 AI 还没完成响应,直接回复用户 AI 还在响应,让用户过一会儿再重试。如果 AI 此时已响应完成,则直接把 内容返回给用户。

  // 找一下,是否已有记录
+  const message = await Message.findOne({
+    where: {
+      fromUser: FromUserName,
+      request: Content,
+    },
+  });
+
+  // 已回答,直接返回消息
+  if (message?.status === MESSAGE_STATUS_ANSWERED) {
+    return `[GPT]: ${message?.response}`;
+  }
+
+  // 在回答中
+  if (message?.status === MESSAGE_STATUS_THINKING) {
+    return AI_THINKING_MESSAGE;
+  }
+

4.最后就是一个 Promise.race

  const message = await Promise.race([
+    // 3秒微信服务器就会超时,超过2.9秒要提示用户重试
+    sleep(2900).then(() => AI_THINKING_MESSAGE),
+    getAIMessage({ Content, FromUserName }),
+  ]);
+

这样子大概就能实现超时之前返回了。

五、会话保存

掉接口是一次性的,一次接口调用完之后怎么做到下一次通话的时候,还能继续保持会话,是不是应该类似客户端与服务端那种有个session这种,但是实际上在openai里是没有session这种东西的,令人震惊的是,chatgpt里是通过前几次会话拼接起来一起发送给chatgpt里的,需要通过回车符来拼接。

async function buildCtxPrompt({ FromUserName }) {
+  // 获取最近10条对话
+  const messages = await Message.findAll({
+    where: {
+      fromUser: FromUserName,
+      aiType: AI_TYPE_TEXT,
+    },
+    limit: 10,
+    order: [['updatedAt', 'ASC']],
+  });
+  // 只有一条的时候,就不用封装上下文了
+  return messages.length === 1
+    ? messages[0].request
+    : messages
+        .map(({ response, request }) => `Q: ${request}\n A: ${response}`)
+        .join('\n');
+}
+

之后就可以实现会话之间的保存通信了。

image-20230218203309437

六、其他问题

6.1 限频

chatgpt毕竟也是新上线的,火热是肯定的,聊天窗口只能开几个,api调用的话,也是有限频的,但是规则具体没有找到,只是在调用次数过多的时候会报429的错误,出现之后就需要等待一个小时左右。

对于这个的解决办法只能是多开几个账号,一旦429就只能换个账号重试了。

6.2 秘钥key被更新

没有找到详细的规则,凭个人经验的话,可能github提交的代码会被扫描,可能ip调用的来源不一样,最好还是开发一个秘钥,生产一个秘钥吧。

6.3 为啥和官网的回复不一样

我们这里用的模型算法是text-davinci-003,具体可以参考:https://platform.openai.com/docs/models/overview,也算是一个比较老的样本了吧open in new window

image-20230221192417900

从官方文档来看,官方服务版的 ChatGPT 的模型并非基础版的text-davinci-003,而是经过了「微调:fine-tunes」。文档地址在这:platform.openai.com/docs/guides…open in new window

6.4 玄学挂掉

有时候消息没有回复,真的不是我们的问题,chatgpt毕竟太火了,官网的这个能力都经常挂掉,也可以订阅官网修复的通知,一旦修复则会发邮件告知你。

image-20230221175150025

参考:https://juejin.cn/post/7200769439335546935open in new window

最后

记得去微信关注【旅行的树】公众号体验
代码地址:https://github.com/Zephery/wechat-gptopen in new window

+ + + diff --git a/others/index.html b/others/index.html new file mode 100644 index 00000000..2e020a77 --- /dev/null +++ b/others/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + Others | 个人博客 + + + + + + + + + diff --git a/others/tesla.html b/others/tesla.html new file mode 100644 index 00000000..7115b9ec --- /dev/null +++ b/others/tesla.html @@ -0,0 +1,75 @@ + + + + + + + + + + Tesla api | 个人博客 + + + + + +
跳至主要內容

Tesla api

Zephery约 1339 字大约 4 分钟

Tesla api

一、特斯拉应用申请

1.1 创建 Tesla 账户

如果您还没有 Tesla 账户,请创建账户。验证您的电子邮件并设置多重身份验证。

正常创建用户就好,然后需要开启多重身份认证,这边常用的是mircrosoft的Authenticator.

image-20231210142130054image-20231210142415598

注意点:(1)不要用自己车辆的邮箱来注册(2)有些邮箱不是特斯拉开发者的邮箱,可能用这些有些无法正常提交访问请求。

1.2 提交访问请求

点击下方的“提交请求”按钮,请求应用程序访问权限。登录后,请提供您的合法企业详细信息、应用程序名称及描述和使用目的。在您提交了详细信息之后,我们会审核您的请求并通过电子邮件向您发送状态更新。

这一步很坑,多次尝试之后都无果,原因也不知道是为啥,只能自己去看返回报文琢磨,太难受了,下面是自己踩的坑

(1)Invalid domain

image-20231210144504486

无效的域名,这里我用的域名是腾讯云个人服务器的域名,证书是腾讯云免费一年的证书,印象中第一申请的时候还是能过的,第二次的时候就不行了,可能被识别到免费的ssl证书不符合规范,还是需要由合法机构的颁发证书才行。所以,为了金快速申请通过,先填个https://baidu.com吧open in new window。当然,后续需要彻底解决自己域名证书的问题,我改为使用阿里云的ssl证书,3个月到期的那种。

(2)Unable to Onboard

image-20231210142930976

应用无法上架,可能原因为邮箱不对,用了之前消费者账号(即自己的车辆账号),建议换别的邮箱试试。

(3) Rejected

image-20231210143156308

这一步尝试了很多次,具体原因为国内还无法正常使用tesla api,只能切换至美国服务器申请下(截止2023-11-15),后续留意官网通知。

1.3 访问应用程序凭据

一旦获得批准,将为您的应用程序生成可在登录后访问的客户端 ID 和客户端密钥。使用这些凭据,通过 OAuth 2.0 身份验证获取用户访问令牌。访问令牌可用于对提供私人用户账户信息或代表其他账户执行操作的请求进行身份验证。

申请好就可以在自己的账号下看到自己的应用了,

image-20231210144244888

1.4 开始 API 集成

按照 API 文档和设置说明将您的应用程序与 Tesla 车队 API 集成。您需要生成并注册公钥,请求用户授权并按照规格要求拨打电话。完成后您将能够与 API 进行交互,并开始围绕 Tesla 设备构建集成。

二、开发之前的准备

由于特斯拉刚推出,并且国内进展缓慢,很多都申请不下来,下面内容均以北美区域进行调用。

2.1 认识token

app与特斯拉交互的共有两个令牌(token)方式,在调用api的时候,特别需要注意使用的是哪种token,下面是两种token的说明:

(1)合作伙伴身份验证令牌:这个就是你申请的app的令牌

(2)客户生成第三方令牌:这个是消费者在你这个app下授权之后的令牌。

此外,还需要注意下,中国大陆地区对应的api地址是 https://fleet-api.prd.cn.vn.cloud.tesla.cnopen in new window,不要调到别的地址去了。

2.2 获取第三方应用token

这一步官网列的很详细,就不在详述了。

CLIENT_ID=<command to obtain a client_id>
+CLIENT_SECRET=<secure command to obtain a client_secret>
+AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com"
+# Partner authentication token request
+curl --request POST \
+  --header 'Content-Type: application/x-www-form-urlencoded' \
+  --data-urlencode 'grant_type=client_credentials' \
+  --data-urlencode "client_id=$CLIENT_ID" \
+  --data-urlencode "client_secret=$CLIENT_SECRET" \
+  --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \
+  --data-urlencode "audience=$AUDIENCE" \
+  'https://auth.tesla.com/oauth2/v3/token'
+
+

2.3 验证域名归属

2.1.1 Register

完成注册合作方账号之后才可以访问API. 每个developer.tesla.cn上的应用程序都必须完成此步骤。官网挂了一个github的代码,看了半天,以为要搞很多东西,实际上只需要几步就可以了。

cd vehicle-command/cmd/tesla-keygen
+go build .
+./tesla-keygen -f -keyring-debug -key-file=private create > public_key.pem
+

这里只是生成了公钥,需要把公钥挂载到域名之下,我们用的是nginx,所以只要指向pem文件就可以了,注意下nginx是否可以访问到改文件,如果不行,把nginx的user改为root。

    location ~ ^/.well-known {
+           default_type text/html;
+           alias /root/vehicle-command/cmd/tesla-keygen/public_key.pem;
+    }
+

随后,便是向tesla注册你的域名,域名必须和你申请的时候填的一样。

curl --header 'Content-Type: application/json' \
+  --header "Authorization: Bearer $TESLA_API_TOKEN" \
+  --data '{"domain":"string"}' \
+  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts' 
+
+

2.1.2 public_key

最后,验证一下是否真的注册成功(GET /api/1/partner_accounts/public_key)

curl --header 'Content-Type: application/json' \
+  --header "Authorization: Bearer $TESLA_API_TOKEN" \
+  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key' 
+

得到下面内容就代表成功了

{"response":{"public_key":"xxxx"}}
+

至此,我们的开发准备就完成了,接下来就是正常的开发与用户交互的api。

+ + + diff --git "a/personalWebsite/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html" "b/personalWebsite/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html" new file mode 100644 index 00000000..9067688f --- /dev/null +++ "b/personalWebsite/1.\345\216\206\345\217\262\344\270\216\346\236\266\346\236\204.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 1.历史与架构 | 个人博客 + + + + + +
跳至主要內容

1.历史与架构

Zephery约 2033 字大约 7 分钟

1.历史与架构

各位大佬瞄一眼我的个人网站open in new window呗 。如果觉得不错,希望能在GitHub上麻烦给个star,GitHub地址https://github.com/Zephery/newblogopen in new window
大学的时候萌生的一个想法,就是建立一个个人网站,前前后后全部推翻重构了4、5遍,现在终于能看了,下面是目前的首页。

由原本的ssh变成ssm,再变成ssm+shiro+lucene,到现在的前后台分离。前台使用ssm+lucene,后台使用spring boot+shiro。其中,使用pagehelper作为分页,lucene用来搜索和自动补全,使用百度统计的API做了个日志系统,统计pv和uv什么的,同时,还有使用了JMX来观察JVM的使用和cpu的使用率,机器学习方面,使用了adaboost和朴素贝叶斯对微博进行分类,有兴趣的可以点点有点意思open in new window这个页面。
本文从下面这几个方面来讲讲网站的建立:

  1. 建站故事与网站架构open in new window
  2. lucene搜索的使用open in new window
  3. 使用quartz来定时备份数据库open in new window
  4. 使用百度统计api做日志系统open in new window
  5. Nginx小集群的搭建open in new window
  6. [数据库]
  7. 使用机器学习对微博进行分析
  8. 网站性能优化
  9. SEO优化

1.建站故事与网站架构

1.1建站过程

起初,是因为学习的时候老是找不到什么好玩而又有挑战性的项目,看着struts、spring、hibernate的书,全都是一些小项目,做了感觉也没啥意义,有时候在博客园看到别人还有自己的网站,特羡慕,最终就选择了自己做一个个人网站。期初刚学的ssh,于是开始了自己的ssh搭建个人网站的行程,但是对于一个后端的人来说,前端是个大问题啊。。。。所以初版的时候差不多全是纯生的html、css、js,至少发博客这个功能实现了,但是确实没法看。前前后后折腾了一个多月,决定推翻重做,到百度看看别人怎么做的。首先看到的是杨青open in new window的网站,已经好几年没更新了,前端的代码看起来比较简单,也是自己能够掌握的,但是不够美观,继续找,在模板之家发现了一个高大上的模板。

第二版的界面确实是这样的,只是把图片的切换变成了wowslider,也是简单的用bootstrap和pagehelper做了下分页,现在的最终版保留了它的header,然后评论框使用了多说(超级怀念多说)。后端也由原来的ssh变成了ssm,之后加上了lucene来对文章进行索引。之后,随着多说要关闭了,突然之间有很多div都不适应了(我写死了的。。。),再一次,没法看,不想看,一怒之下再次推翻重做,变成了现在这个版本。

最终版本在考虑时,也找了很多模板,影响深刻的是taleopen in new window欲思open in new window这两个主题,期中,tale使用的是java语言写的,刚知道的那一刻我就没好感了,java后端我是要自己全部写的,tale这个页面简洁但是不够炫,而且内容量太低,可能就只是个纯博客,之后发现了欲思,拓展性强,只可惜没有静态的版本,后台是纯生的PHP(嗯,PHP是世界上最好的语言),看了看,没事,保存网页,前端自己改,后端自己全部重写,最终变成了现在这个版本,虽然拼接的时候各种css、js混入。。。。还好在做网站性能优化的时候差不多全部去掉了。最终版加入redis、quartz、shiro等,还有python机器学习、flask的restful api,可谓是大杂烩了。
页面看着还算凑合,至少不是那种看都看不过去的那种了,但是仔细看看,还是有不少问题的,比如瀑布流,还有排版什么的。只能等自己什么时候想认真学学前端的东西了。
已经部署在腾讯云服务器上,存储使用了七牛云的cdn。

1.2 网站整体技术架构

最终版的技术架构图如下:

网站核心主要采用Spring SpringMVC和Mybatis,下图是当访问一篇博客的时候的运行流程,参考了张开涛open in new window的博客。

运行流程分析

  1. 浏览器发送http请求。/blogdetail.html?blogid=1。
  2. tomcat容器初始化,顺序为context-param>listener>filter>servlet,此时,spring中的bean还没有被注入的,不建议在此处加载bean,网站声明了两个类(IPFilter和CacheControlFilter),IPFilter用来拦截IP,CacheControlFilter用来缓存。
  3. 初始化Spring。
  4. DispatcherServlet——>HandlerMapping进行请求到处理的映射,HandlerMapping将“/blogdetail”路径直接映射到名字为“/blogdetail”的Bean进行处理,即BlogController。
  5. 自定义拦截器,其中BaseIntercepter实现了HandleInterceptor的接口,用来记录每次访问的链接以及后台响应的时间。
  6. DispatcherServlet——> SimpleControllerHandlerAdapter,SimpleControllerHandlerAdapter将HandlerExecutionChain中的处理器适配为BlogController。
  7. BlogController执行查询,取得结果集返回数据。
  8. blogdetail(ModelAndView的逻辑视图名)——>InternalResourceViewResolver, InternalResourceViewResolver使用JstlView,具体视图页面在/blogdetail.jsp。
  9. JstlView(/blogdetail.jsp)——>渲染,将在处理器传入的模型数据(blog=Blog!)在视图中展示出来。
  10. 返回响应。

1.3 日志系统

日志系统架构如下:

日志系统open in new window曾经尝试采用过ELK,实时监控实在是让人不能不称赞,本地也跑起来了,但是一到服务器,卡卡卡,毕竟(1Ghz CPU、1G内存),只能放弃ELK,采用百度统计。百度统计提供了Tongji API供开发者使用,只是有次数限制,2000/日,实时的话实在有点低,只能统计前几天的PV、UV等开放出来。其实这个存放在mysql也行,不过这些零碎的数据还是放在redis中,方便管理。
出了日志系统,自己对服务器的一些使用率也是挺关心的,毕竟服务器配置太低,于是利用了使用了tomcat的JMX来对CPU和jvm使用情况进行监控,这两个都是实时的。出了这两个,对内存的分配做了监控,Eden、Survivor、Tenured的使用情况。

1.4 【有点意思】自然语言处理

本人大学里的毕业设计就是基于AdaBoost算法的情感分类,学到的东西还是要经常拿出来看看,要不然真的浪费了我这么久努力做的毕业设计啊。构建了一个基本的情感分类小系统,每天抓取微博进行分类存储在MySql上,并使用flask提供Restful API给java调用,可以点击这里open in new window尝试(请忽略Google的图片)。目前分类效果不是很明显,准确率大概只有百分之70%,因为训练样本只有500条(找不到训练样本),机器学习真的太依赖样本的标注。这个,只能请教各位路人大神指导指导了。

总结

断断续续,也总算做了一个能拿得出手仍要遮遮掩掩才能给别人看的网站,哈哈哈哈哈,也劳烦各位帮忙找找bug。前前后后从初学Java EE就一直设想的事也还算有了个了结,以后要多多看书,写点精品文章。PS:GitHub上求给个Staropen in new window,以后面试能讲讲这个网站。

+ + + diff --git "a/personalWebsite/10.\347\275\221\347\253\231\351\207\215\346\236\204.html" "b/personalWebsite/10.\347\275\221\347\253\231\351\207\215\346\236\204.html" new file mode 100644 index 00000000..ec02b94e --- /dev/null +++ "b/personalWebsite/10.\347\275\221\347\253\231\351\207\215\346\236\204.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 网站重构 | 个人博客 + + + + + + + + + diff --git "a/personalWebsite/2.Lucene\347\232\204\344\275\277\347\224\250.html" "b/personalWebsite/2.Lucene\347\232\204\344\275\277\347\224\250.html" new file mode 100644 index 00000000..19651639 --- /dev/null +++ "b/personalWebsite/2.Lucene\347\232\204\344\275\277\347\224\250.html" @@ -0,0 +1,286 @@ + + + + + + + + + + 2.Lucene的使用 | 个人博客 + + + + + +
跳至主要內容

2.Lucene的使用

Zephery约 2039 字大约 7 分钟

2.Lucene的使用

首先,帮忙点击一下我的网站http://www.wenzhihuai.com/open in new window 。谢谢啊,如果可以,GitHub上麻烦给个star,以后面试能讲讲这个项目,GitHub地址https://github.com/Zephery/newblogopen in new window

Lucene的整体架构

image
image

搜索引擎的几个重要概念:

  1. 倒排索引:将文档中的词作为关键字,建立词与文档的映射关系,通过对倒排索引的检索,可以根据词快速获取包含这个词的文档列表。倒排索引一般需要对句子做去除停用词。

  2. 停用词:在一段句子中,去掉之后对句子的表达意向没有印象的词语,如“非常”、“如果”,中文中主要包括冠词,副词等。

  3. 排序:搜索引擎在对一个关键词进行搜索时,可能会命中许多文档,这个时候,搜索引擎就需要快速的查找的用户所需要的文档,因此,相关度大的结果需要进行排序,这个设计到搜索引擎的相关度算法。

Lucene中的几个概念

  1. 文档(Document):文档是一系列域的组合,文档的域则代表一系列域文档相关的内容。
  2. 域(Field):每个文档可以包含一个或者多个不同名称的域。
  3. 词(Term):Term是搜索的基本单元,与Field相对应,包含了搜索的域的名称和关键词。
  4. 查询(Query):一系列Term的条件组合,成为TermQuery,但也有可能是短语查询等。
  5. 分词器(Analyzer):主要是用来做分词以及去除停用词的处理。

索引的建立

索引的搜索

lucene在本网站的使用:

  1. 搜索 2. 自动分词

一、搜索

注意:本文使用最新的lucene,版本6.6.0。lucene的版本更新很快,每跨越一次大版本,使用方式就不一样。首先需要导入lucene所使用的包。使用maven:

<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-core</artifactId><!--lucene核心-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-analyzers-common</artifactId><!--分词器-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-analyzers-smartcn</artifactId><!--中文分词器-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-queryparser</artifactId><!--格式化-->
+    <version>${lucene.version}</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-highlighter</artifactId><!--lucene高亮-->
+    <version>${lucene.version}</version>
+</dependency>
+
  1. 构建索引
Directory dir = FSDirectory.open(Paths.get("blog_index"));//索引存储的位置
+SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();//简单的分词器
+IndexWriterConfig config = new IndexWriterConfig(analyzer);
+IndexWriter writer = new IndexWriter(dir, config);
+Document doc = new Document();
+doc.add(new TextField("title", blog.getTitle(), Field.Store.YES)); //对标题做索引
+doc.add(new TextField("content", Jsoup.parse(blog.getContent()).text(), Field.Store.YES));//对文章内容做索引
+writer.addDocument(doc);
+writer.close();
+
  1. 更新与删除
IndexWriter writer = getWriter();
+Document doc = new Document();
+doc.add(new TextField("title", blog.getTitle(), Field.Store.YES));
+doc.add(new TextField("content", Jsoup.parse(blog.getContent()).text(), Field.Store.YES));
+writer.updateDocument(new Term("blogid", String.valueOf(blog.getBlogid())), doc);   //更新索引
+writer.close();
+
  1. 查询
private static void search_index(String keyword) {
+    try {
+        Directory dir = FSDirectory.open(Paths.get("blog_index")); //获取要查询的路径,也就是索引所在的位置
+        IndexReader reader = DirectoryReader.open(dir);
+        IndexSearcher searcher = new IndexSearcher(reader);
+        SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();
+        QueryParser parser = new QueryParser("content", analyzer); //查询解析器
+        Query query = parser.parse(keyword); //通过解析要查询的String,获取查询对象
+        TopDocs docs = searcher.search(query, 10);//开始查询,查询前10条数据,将记录保存在docs中,
+        for (ScoreDoc scoreDoc : docs.scoreDocs) { //取出每条查询结果
+            Document doc = searcher.doc(scoreDoc.doc); //scoreDoc.doc相当于docID,根据这个docID来获取文档
+            System.out.println(doc.get("title")); //fullPath是刚刚建立索引的时候我们定义的一个字段
+        }
+        reader.close();
+    } catch (IOException | ParseException e) {
+        logger.error(e.toString());
+    }
+}
+
  1. 高亮
Fragmenter fragmenter = new SimpleSpanFragmenter(scorer);
+SimpleHTMLFormatter simpleHTMLFormatter = new SimpleHTMLFormatter("<b><font color='red'>", "</font></b>");
+Highlighter highlighter = new Highlighter(simpleHTMLFormatter, scorer);
+highlighter.setTextFragmenter(fragmenter);
+for (ScoreDoc scoreDoc : docs.scoreDocs) { //取出每条查询结果
+    Document doc = searcher.doc(scoreDoc.doc); //scoreDoc.doc相当于docID,根据这个docID来获取文档
+    String title = doc.get("title");
+    TokenStream tokenStream = analyzer.tokenStream("title", new StringReader(title));
+    String hTitle = highlighter.getBestFragment(tokenStream, title);
+    System.out.println(hTitle);
+}
+

结果

<b><font color='red'>Java</font></b>堆.栈和常量池 笔记
+
  1. 分页
    目前lucene分页的方式主要有两种:
    (1). 每次都全部查询,然后通过截取获得所需要的记录。由于采用了分词与倒排索引,所有速度是足够快的,但是在数据量过大的时候,占用内存过大,容易造成内存溢出
    (2). 使用searchAfter把数据保存在缓存里面,然后再去取。这种方式对大量的数据友好,但是当数据量比较小的时候,速度会相对慢。
    lucene中使用searchafter来筛选顺序
ScoreDoc lastBottom = null;//相当于pageSize
+BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();
+QueryParser parser1 = new QueryParser("title", analyzer);//对文章标题进行搜索
+Query query1 = parser1.parse(q);
+booleanQuery.add(query1, BooleanClause.Occur.SHOULD);
+TopDocs hits = search.searchAfter(lastBottom, booleanQuery.build(), pagehits);  //lastBottom(pageSize),pagehits(pagenum)
+
  1. 使用效果
    全部代码放在这里open in new window,代码写的不太好,光从代码规范上就不咋地。在网页上的使用效果如下:

二、lucene自动补全

百度、谷歌等在输入文字的时候会弹出补全框,如下图:

在搭建lucene自动补全的时候,也有考虑过使用SQL语句中使用like来进行,主要还是like对数据库压力会大,而且相关度没有lucene的高。主要使用了官方suggest库以及autocompelte.jsopen in new window这个插件。
suggest的原理看这open in new window,以及索引结构看这open in new window

使用:

  1. 导入maven包
<dependency>
+    <groupId>org.apache.lucene</groupId>
+    <artifactId>lucene-suggest</artifactId>
+    <version>6.6.0</version>
+</dependency>
+
  1. 如果想将结果反序列化,声明实体类的时候要加上:
public class Blog implements Serializable {
+
  1. 实现InputIterator接口
InputIterator的几个方法:
+long weight():返回的权重值,大小会影响排序,默认是1L
+BytesRef payload():对某个对象进行序列化
+boolean hasPayloads():是否有设置payload信息
+Set<BytesRef> contexts():存入context,context里可以是任意的自定义数据,一般用于数据过滤
+boolean hasContexts():判断是否有下一个,默认为false
+
public class BlogIterator implements InputIterator {
+    /**
+     * logger
+     */
+    private static final Logger logger = LoggerFactory.getLogger(BlogIterator.class);
+    private Iterator<Blog> blogIterator;
+    private Blog currentBlog;
+
+    public BlogIterator(Iterator<Blog> blogIterator) {
+        this.blogIterator = blogIterator;
+    }
+
+    @Override
+    public boolean hasContexts() {
+        return true;
+    }
+
+    @Override
+    public boolean hasPayloads() {
+        return true;
+    }
+
+    public Comparator<BytesRef> getComparator() {
+        return null;
+    }
+
+    @Override
+    public BytesRef next() {
+        if (blogIterator.hasNext()) {
+            currentBlog = blogIterator.next();
+            try {
+                //返回当前Project的name值,把blog类的name属性值作为key
+                return new BytesRef(Jsoup.parse(currentBlog.getTitle()).text().getBytes("utf8"));
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 将Blog对象序列化存入payload
+     * 可以只将所需要的字段存入payload,这里对整个实体类进行序列化,方便以后需求,不建议采用这种方法
+     */
+    @Override
+    public BytesRef payload() {
+        try {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream(bos);
+            out.writeObject(currentBlog);
+            out.close();
+            BytesRef bytesRef = new BytesRef(bos.toByteArray());
+            return bytesRef;
+        } catch (IOException e) {
+            logger.error("", e);
+            return null;
+        }
+    }
+
+    /**
+     * 文章标题
+     */
+    @Override
+    public Set<BytesRef> contexts() {
+        try {
+            Set<BytesRef> regions = new HashSet<BytesRef>();
+            regions.add(new BytesRef(currentBlog.getTitle().getBytes("UTF8")));
+            return regions;
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException("Couldn't convert to UTF-8");
+        }
+    }
+
+    /**
+     * 返回权重值,这个值会影响排序
+     * 这里以产品的销售量作为权重值,weight值即最终返回的热词列表里每个热词的权重值
+     */
+    @Override
+    public long weight() {
+        return currentBlog.getHits();   //change to hits
+    }
+}
+
  1. ajax 建立索引
/**
+ * ajax建立索引
+ */
+@Override
+public void ajaxbuild() {
+    try {
+        Directory dir = FSDirectory.open(Paths.get("autocomplete"));
+        SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();
+        AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(dir, analyzer);
+        //创建Blog测试数据
+        List<Blog> blogs = blogMapper.getAllBlog();
+        suggester.build(new BlogIterator(blogs.iterator()));
+    } catch (IOException e) {
+        System.err.println("Error!");
+    }
+}
+
  1. 查找
    因为有些文章的标题是一样的,先对list排序,将标题短的放前面,长的放后面,然后使用LinkHashSet来存储。
@Override
+public Set<String> ajaxsearch(String keyword) {
+    try {
+        Directory dir = FSDirectory.open(Paths.get("autocomplete"));
+        SmartChineseAnalyzer analyzer = new SmartChineseAnalyzer();
+        AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(dir, analyzer);
+        List<String> list = lookup(suggester, keyword);
+        list.sort(new Comparator<String>() {
+            @Override
+            public int compare(String o1, String o2) {
+                if (o1.length() > o2.length()) {
+                    return 1;
+                } else {
+                    return -1;
+                }
+            }
+        });
+        Set<String> set = new LinkedHashSet<>();
+        for (String string : list) {
+            set.add(string);
+        }
+        ssubSet(set, 7);
+        return set;
+    } catch (IOException e) {
+        System.err.println("Error!");
+        return null;
+    }
+}
+
  1. controller层
@RequestMapping("ajaxsearch")
+public void ajaxsearch(HttpServletRequest request, HttpServletResponse response) throws IOException {
+    String keyword = request.getParameter("keyword");
+    if (StringUtils.isEmpty(keyword)) {
+        return;
+    }
+    Set<String> set = blogService.ajaxsearch(keyword);
+    Gson gson = new Gson();
+    response.getWriter().write(gson.toJson(set));//返回的数据使用json
+}
+
  1. ajax来提交请求
    autocomplete.js源代码与介绍:https://github.com/xdan/autocompleteopen in new window
<link rel="stylesheet" href="js/autocomplete/jquery.autocomplete.css">
+<script src="js/autocomplete/jquery.autocomplete.js" type="text/javascript"></script>
+<script type="text/javascript">
+    /******************** remote start **********************/
+    $('#remote_input').autocomplete({
+        source: [
+            {
+                url: "ajaxsearch.html?keyword=%QUERY%",
+                type: 'remote'
+            }
+        ]
+    });
+    /********************* remote end ********************/
+</script>
+
  1. 效果:

欢迎访问我的个人网站open in new window

参考:
https://www.ibm.com/developerworks/cn/java/j-lo-lucene1/open in new window

http://iamyida.iteye.com/blog/2205114open in new window

+ + + diff --git "a/personalWebsite/3.\345\256\232\346\227\266\344\273\273\345\212\241.html" "b/personalWebsite/3.\345\256\232\346\227\266\344\273\273\345\212\241.html" new file mode 100644 index 00000000..56088ebb --- /dev/null +++ "b/personalWebsite/3.\345\256\232\346\227\266\344\273\273\345\212\241.html" @@ -0,0 +1,116 @@ + + + + + + + + + + 3.定时任务 | 个人博客 + + + + + +
跳至主要內容

3.定时任务

Zephery约 1063 字大约 4 分钟

3.定时任务

先看一下Quartz的架构图:

一.特点:

  1. 强大的调度功能,例如支持丰富多样的调度方法,可以满足各种常规及特殊需求;
  2. 灵活的应用方式,例如支持任务和调度的多种组合方式,支持调度数据的多种存储方式;
  3. 分布式和集群能力。

二.主要组成部分

  1. JobDetail:需实现该接口定义的人物,其中JobExecutionContext提供了上下文的各种信息。
  2. JobDetail:QUartz的执行任务的类,通过newInstance的反射机制实例化Job。
  3. Trigger: Job的时间触发规则。主要有SimpleTriggerImpl和CronTriggerImpl两个实现类。
  4. Calendar:org.quartz.Calendar和java.util.Calendar不同,它是一些日历特定时间点的集合(可以简单地将org.quartz.Calendar看作java.util.Calendar的集合——java.util.Calendar代表一个日历时间点,无特殊说明后面的Calendar即指org.quartz.Calendar)。
  5. Scheduler:由上图可以看出,Scheduler是Quartz独立运行的容器。其中,Trigger和JobDetail可以注册到Scheduler中。
  6. ThreadPool:Scheduler使用一个线程池作为任务运行的基础设施,任务通过共享线程池中的线程提高运行效率。

三、Quartz设计

  1. properties file
    官网open in new window中表明:quartz中使用了quartz.properties来对quartz进行配置,并保留在其jar包中,如果没有定义则默认使用改文件。

四、使用

  1. hello world!代码在这
  2. 本网站中使用quartz来对数据库进行备份,与Spring结合
    (1)导入spring的拓展包,其协助spring集成第三方库:邮件服务、定时任务、缓存等。。。
<dependency>
+    <groupId>org.springframework</groupId>
+    <artifactId>spring-context-support</artifactId>
+    <version>4.2.6.RELEASE</version>
+</dependency>
+

(2)导入quartz包

<dependency>
+    <groupId>org.quartz-scheduler</groupId>
+    <artifactId>quartz</artifactId>
+    <version>2.3.0</version>
+</dependency>
+

(3)mysql远程备份
使用命令行工具仅仅需要一行:

mysqldump -u [username] -p[password] -h [hostip] database > file
+

但是java不能直接执行linux的命令,仍旧需要依赖第三方库ganymed

<dependency>
+    <groupId>ch.ethz.ganymed</groupId>
+    <artifactId>ganymed-ssh2</artifactId>
+    <version>262</version>
+</dependency>
+

完整代码如下:

@Component("mysqlService")//在spring中注册一个mysqlService的Bean
+public class MysqlUtil {
+    ...
+    StringBuffer sb = new StringBuffer();
+    sb.append("mysqldump -u " + username + " -p" + password + " -h " + host + " " +
+            database + " >" + file);
+    String sql = sb.toString();
+    Connection connection = new Connection(s_host);
+    connection.connect();
+    boolean isAuth = connection.authenticateWithPassword(s_username, s_password);//进行远程服务器登陆认证
+    if (!isAuth) {
+        logger.error("server login error");
+    }
+    Session session = connection.openSession();
+    session.execCommand(sql);//执行linux语句
+    InputStream stdout = new StreamGobbler(session.getStdout());
+    BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
+    ...
+}
+

(4)spring中配置quartz

<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
+    <property name="targetObject" ref="mysqlService"/>
+    <property name="targetMethod" value="exportDataBase"/>
+</bean>
+<!--定义触发时间  -->
+<bean id="myTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
+    <property name="jobDetail" ref="jobDetail"/>
+    <!-- cron表达式,每周五2点59分运行-->
+    <property name="cronExpression" value="0 59 2 ? * FRI"/>
+</bean>
+<!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->
+<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
+    <property name="triggers">
+        <list>
+            <ref bean="myTrigger"/>
+        </list>
+    </property>
+</bean>
+

(5)java完整文件在这open in new window

Spring的高级特性之定时任务

java ee项目的定时任务中除了运行quartz之外,spring3+还提供了task,可以看做是一个轻量级的Quartz,而且使用起来比Quartz简单的多。

(1)spring配置文件中配置:

<task:annotation-driven/>
+

(2)最简单的例子,在所需要的函数上添加定时任务即可运行

    @Scheduled(fixedRate = 5000)
+    public void reportCurrentTime() {
+        System.out.println("每隔5秒运行一次" + sdf.format(new Date()));
+    }
+

(3)运行的时候会报错:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined
+	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:372)
+	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)
+	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.finishRegistration(ScheduledAnnotationBeanPostProcessor.java:192)
+	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:171)
+	at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:86)
+	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
+	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
+	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:380)
+

参考:
1.http://blog.csdn.net/oarsman/article/details/52801877open in new window
2.http://stackoverflow.com/questions/31199888/spring-task-scheduler-no-qualifying-bean-of-type-org-springframework-scheduliopen in new window
Spring的定时任务调度器会尝试获取一个注册过的 task scheduler来做任务调度,它会尝试通过BeanFactory.getBean的方法来获取一个注册过的scheduler bean,获取的步骤如下:

1.尝试从配置中找到一个TaskScheduler Bean

2.寻找ScheduledExecutorService Bean

3.使用默认的scheduler
修改log4j.properties即可:
log4j.logger.org.springframework.scheduling=INFO
其实这个功能不影响定时器的功能。
(4)结果:

每隔5秒运行一次14:44:34
+每隔5秒运行一次14:44:39
+每隔5秒运行一次14:44:44
+
+ + + diff --git "a/personalWebsite/4.\346\227\245\345\277\227\347\263\273\347\273\237.html" "b/personalWebsite/4.\346\227\245\345\277\227\347\263\273\347\273\237.html" new file mode 100644 index 00000000..b7b98fa4 --- /dev/null +++ "b/personalWebsite/4.\346\227\245\345\277\227\347\263\273\347\273\237.html" @@ -0,0 +1,269 @@ + + + + + + + + + + 4.日志系统.md | 个人博客 + + + + + +
跳至主要內容

4.日志系统.md

Zephery约 2883 字大约 10 分钟

4.日志系统.mdopen in new window

欢迎访问我的网站http://www.wenzhihuai.com/open in new window 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblogopen in new window

建立网站少不了日志系统,用来查看网站的访问次数、停留时间、抓取量、目录抓取统计、页面抓取统计等,其中,最常用的方法还是使用ELK,但是,本网站的服务器配置实在太低了(1GHZ、2G内存),压根就跑不起ELK,所以只能寻求其他方式,目前最常用的有百度统计open in new window友盟open in new window,这里,本人使用的是百度统计,提供了API给开发者使用,能够将自己所需要的图表移植到自己的网站上。日志是网站及其重要的文件,通过对日志进行统计、分析、综合,就能有效地掌握网站运行状况,发现和排除错误原因,了解客户访问分布等,更好的加强系统的维护和管理。下面是我的百度统计的概览页面:

企业级的网站日志不能公开,但是我的是个人网站,用来跟大家一起学习的,所以,需要将百度的统计页面展示出来,但是,百度并不提供日志的图像,只提供API给开发者调用,而且还限制访问次数,一天不能超过2000次,这个对于实时统计来说,确实不够,所以只能展示前几天的访问统计。这里的日志系统分为三个步骤:1.API获取数据;2.存储数据;3.展示数据。页面效果如下,也可以点开我的网站的日志系统open in new window:

百度统计提供了Tongji API的Java和Python版本,这两个版本及其复杂,可用性极低,所以,本人用Python写了个及其简单的通用版本,整体只有28行,代码在这,https://github.com/Zephery/baidutongjiopen in new window。下面是具体过程

1.网站代码安装

先在百度统计中注册登录之后,进入管理页面,新增网站,然后在代码管理中获取安装代码,大部分人的代码都是类似的,除了hm.js?后面的参数,是记录该网站的唯一标识。

<script>
+var _hmt = _hmt || [];
+(function() {
+  var hm = document.createElement("script");
+  hm.src = "https://hm.baidu.com/hm.js?code";
+  var s = document.getElementsByTagName("script")[0];
+  s.parentNode.insertBefore(hm, s);
+})();
+</script>
+

同时,需要在申请其他设置->数据导出服务中开通数据导出服务,百度统计Tongji API可以为网站接入者提供便捷的获取网站流量数据的通道。

至此,我们获得了username、password、token,然后开始使用三个参数来获取数据。

2.根据API获取数据

官网的APIopen in new window详细的记录了接口的参数以及解释,
链接:https://api.baidu.com/json/tongji/v1/ReportService/getDataopen in new window,详细的官方报告请访问官网TongjiApiopen in new window
所需参数(必须):

参数名称参数类型描述
methodstring要查询的报告
start_datestring查询起始时间
end_datestring查询结束时间
metricsstring自定义指标

其中,参数start_date和end_date的规定为:yyyyMMdd,这里我们使用python的原生库,datetime、time,获取昨天的时间以及前七天的日期。

today = datetime.date.today()   # 获取今天的日期
+yesterday = today - datetime.timedelta(days=1) # 获取昨天的日期
+fifteenago = today - datetime.timedelta(days=7) # 获取前七天的日期
+end, start = str(yesterday).replace("-", ""), str(fifteenago).replace("-", "")  # 格式化成yyyyMMdd格式
+

3.构建请求

说明:siteId可以根据个人百度统计的链接获取,也可以使用Tongji API的第一个接口列表获取用户的站点列表。首先,我们构建一个类,由于username、password、token都是通用的,所以我们将它设置为构造方法的参数。

class Baidu(object):
+    def __init__(self, siteId, username, password, token):
+        self.siteId = siteId
+        self.username = username
+        self.password = password
+        self.token = token
+

然后构建一个共同的方法,用来获取提交数据之后返回的结果,其中提供了4个可变参数,分别是(start_date:起始日期,end_date:结束日期,method:方法,metrics:指标),返回的是字节,最后需要decode("utf-8")一下变成字符:

def getresult(self, start_date, end_date, method, metrics):
+    body = {"header": {"account_type": 1, "password": self.password, "token": self.token,
+                       "username": self.username},
+            "body": {"siteId": self.siteId, "method": method, "start_date": start_date,
+                     "end_date": end_date,
+                     "metrics": metrics}}
+    data = bytes(json.dumps(body), 'utf8')
+    req = urllib.request.Request(base_url, data)
+    response = urllib.request.urlopen(req)
+    the_page = response.read()
+    return the_page.decode("utf-8")
+

至此,python获取百度统计的过程基本就没了,没错,就是那么简简单单的几行,完整代码见https://github.com/Zephery/baidutongji/blob/master/baidu.pyopen in new window,但是,想要实现获取各种数据,仍需要做很多工作。

4.实际运用

(1)需要使用其他参数怎么办

python中提供了个可变参数来解决这一烦恼,详细请看http://www.jianshu.com/p/98f7e34845b5open in new window,可变参数允许你传入0个或任意个参数,这些可变参数在函数调用时自动组装为一个tuple,而关键字参数允许你传入0个或任意个含参数名的参数,这些关键字参数在函数内部自动组装为一个dict。

def getresult(self, start_date, end_date, method, metrics, **kw):
+    base_url = "https://api.baidu.com/json/tongji/v1/ReportService/getData"
+    body = {"header": {"account_type": 1, "password": self.password, "token": self.token,
+                       "username": self.username},
+            "body": {"siteId": self.siteId, "method": method, "start_date": start_date,
+                     "end_date": end_date, "metrics": metrics}}
+    for key in kw:  #对可变参数进行遍历,如果有的话就往body中加入
+        body['body'][key] = kw[key]
+

使用方式:

result = self.getresult(start, end, "source/all/a",
+                        "pv_count,visitor_count,avg_visit_time", viewType='visitor')  #其中viewTYpe便是可变参数
+

(2)获取的数据如何解析
百度统计返回的结果比较简洁而又反人类,以获取概览中的pv_count,visitor_count,ip_count,bounce_ratio,avg_visit_time为例子:

result = bd.getresult(start, end, "overview/getTimeTrendRpt",
+                      "pv_count,visitor_count,ip_count,bounce_ratio,avg_visit_time")
+

返回的结果是:

[[['2017/09/12'], ['2017/09/13'], ['2017/09/14'], ['2017/09/15'], ['2017/09/16'], ['2017/09/17'], ['2017/09/18']],   
+[[422, 76, 76, 41.94, 221],  
+ [284, 67, 65, 50.63, 215],   
+ [67, 23, 22, 52.17, 153],   
+ [104, 13, 13, 36.36, 243],   
+ [13, 4, 4, 33.33, 66],   
+ [73, 7, 6, 37.5, 652],  
+ [63, 11, 11, 33.33, 385]  
+ ], [], []]
+

即:翻译成人话就是:

[[[date1,date2,...]], 
+ [[date1的pv_count, date1的visitor_count, date1的ip_count, date1的bounce_ratio, date1的avg_visit_time],
+ [date2的pv_count, date2的visitor_count, date2的ip_count, date2的bounce_ratio, date2的avg_visit_time],
+  ...,[]
+ ],[],[]]
+

极其反人类的设计。还好用的python,python数组的特性实在太强了。出了可以运用[x for x in range]这类语法之外,还能与三元符(x if y else x+1,如果y成立,那么结果是x,如果y不成立,那么结果是x+1)一起使用,这里注意:如果当天访问量为0,其返回的json结果是'--',所以要判断是不是为'--',归0化,才能在折线图等各种图上显示。下面是pv_count的例子:

pv_count = [x[0] if x[0] != '--' else 0 for x in result[1]]
+

(3)每周限制2000次
在开通数据导出服务的时候,不知道大家有没有注意到它的说明,即我们是不能实时监控的,只能将它放在临时数据库中,这里我们选择了Redis,并在centos里定义一个定时任务,每天全部更新一次即可。

python中redis的使用方法很简单,连接跟mysql类似:

# 字符串
+pool = redis.ConnectionPool(host='your host ip', port=port, password='your auth')  # TODO redis地址
+r = redis.Redis(connection_pool=pool)
+

本网站使用redis的数据结构只有set,方法也很简单,就是定义一个key,然后value是数组的字符串获取json。

ip_count = [x[2] if x[2] != '--' else 0 for x in result[1]]
+r.set("ip_count", ip_count)
+# json
+name = [item[0]['name'] for item in data[0]]
+count = 0
+tojson = []
+for item in data[1]:
+    temp = {}
+    temp["name"] = name[count]
+    temp["pv_count"] = item[0]
+    temp["visitor_count"] = item[1]
+    temp["average_stay_time"] = item[2]
+    tojson.append(temp)
+    count = count + 1
+r.set("rukouyemian", json.dumps(tojson[:5]))
+

5.基本代码

下面是基本的使用代码,完整的使用代码就不贴了,有兴趣可以去我的github上看看,完整代码open in new window,希望能给个star哈哈哈,感谢

import json
+import time
+import datetime
+import urllib.parse
+import urllib.request
+
+base_url = "https://api.baidu.com/json/tongji/v1/ReportService/getData"
+
+class Baidu(object):
+    def __init__(self, siteId, username, password, token):
+        self.siteId = siteId
+        self.username = username
+        self.password = password
+        self.token = token
+
+    def getresult(self, start_date, end_date, method, metrics, **kw):
+        base_url = "https://api.baidu.com/json/tongji/v1/ReportService/getData"
+        body = {"header": {"account_type": 1, "password": self.password, "token": self.token,
+                           "username": self.username},
+                "body": {"siteId": self.siteId, "method": method, "start_date": start_date,
+                         "end_date": end_date, "metrics": metrics}}
+        for key in kw:
+            body['body'][key] = kw[key]
+        data = bytes(json.dumps(body), 'utf8')
+        req = urllib.request.Request(base_url, data)
+        response = urllib.request.urlopen(req)
+        the_page = response.read()
+        return the_page.decode("utf-8")
+
+if __name__ == '__main__':
+    # 日期开始
+    today = datetime.date.today()
+    yesterday = today - datetime.timedelta(days=1)
+    fifteenago = today - datetime.timedelta(days=7)
+    end, start = str(yesterday).replace("-", ""), str(fifteenago).replace("-", "")
+    # 日期结束
+    bd = Baidu(yoursiteid, "username", "password", "token")
+    result = bd.getresult(start, end, "overview/getTimeTrendRpt",
+                          "pv_count,visitor_count,ip_count,bounce_ratio,avg_visit_time")
+    result = json.loads(result)
+    base = result["body"]["data"][0]["result"]["items"]
+    print(base)
+
+

6.展示数据

在将数据存进redis中之后,我们需要在博客中使用这些数据来制作图表。在newblogopen in new window中使用方式也很简单,大概就是使用jedis读取数据,然后使用echarts或者highcharts展示。其中折线图以及线型图我都使用了highcharts,确实比echarts好看的多,但是地域图还是选择了echarts,毕竟中国的产品还是对中国的支持较好。
(1)PV、UV折线图
以图表PV、UV为例,由于存储进redis的是一个数组,所以,可以直接从redis中读取然后放到一个attribute里即可:

String pv_count = jedis.get("pv_count");
+String visitor_count = jedis.get("visitor_count");
+mv.addObject("pv_count", pv_count);
+mv.addObject("visitor_count", visitor_count);
+

jsp中的使用如下:

<div class="panel-heading" style="background-color: rgba(187,255,255,0.7)">
+    <div class="card-title">
+        <strong>PV和UV折线图</strong>
+    
+    
+    <div class="panel-body">
+        <div id="linecontainer" style="width: auto;height: 330px">
+        <script>
+            var chart = new Highcharts.Chart('linecontainer', {
+                title: {
+                    text: null
+                },
+                credits: {
+                    enabled: false
+                },
+                xAxis: {
+                    categories: ${daterange}
+                },
+                yAxis: {
+                    title: {
+                        text: '次数'
+                    },
+                    plotLines: [{
+                        value: 0,
+                        width: 1,
+                        color: '#808080'
+                    }]
+                },
+                tooltip: {
+                    valueSuffix: '次'
+                },
+                legend: {
+                    borderWidth: 0,
+                    align: "center", //程度标的目标地位
+                    verticalAlign: "top", //垂直标的目标地位
+                    x: 0, //间隔x轴的间隔
+                    y: 0 //间隔Y轴的间隔
+                },
+                series: [{
+                    name: 'pv',
+                    data:${pv_count}
+                }, {
+                    name: 'uv',
+                    data:${visitor_count}
+                }]
+            })
+        </script>
+

效果如下:

(2)地域访问量
在python代码中先获取地域的数据,其结果如下,百度统计跟echarts都是百度的,果然,自家人对自己人的支持真是特别友好的。

[{'pv_count': 649, 'pv_ratio': 7, 'visitor_count': 2684, 'name': '广东'}, {'pv_count': 2, 'pv_ratio': 2, 'visitor_count': 76, 'name': '四川'}, {'pv_count': 1, 'pv_ratio': 1, 'visitor_count': 3, 'name': '江苏'}]
+

地域图目前支持最好的还是百度的echarts,使用方法见echarts的官网吧,这里不再阐述,展示地域图的时候需要获取下载两个文件,china.jsopen in new window(其提供了js和json,这里使用的js),echarts.jsopen in new window
部分代码:

<script type="text/javascript">
+    var myChart = echarts.init(document.getElementById('diyu'));
+    option = {
+        tooltip: {
+            trigger: 'item'
+        },
+        legend: {
+            orient: 'vertical',
+            left: 'left'
+        },
+        visualMap: {
+            min: 0,
+            max:${diyumax},
+            left: 'left',
+            top: 'bottom',
+            text: ['高', '低'],           // 文本,默认为数值文本
+            calculable: true
+        },
+        toolbox: {
+            show: true,
+            orient: 'vertical',
+            left: 'right',
+            top: 'center',
+            feature: {
+                dataView: {readOnly: false},
+                restore: {},
+                saveAsImage: {}
+            }
+        },
+        series: [
+            {
+                name: '访问量',
+                type: 'map',
+                mapType: 'china',
+                roam: false,
+                label: {
+                    normal: {
+                        show: true
+                    },
+                    emphasis: {
+                        show: true
+                    }
+                },
+                data: [
+                    <c:forEach var="diyu" items="${diyu}">
+                    {name: '${diyu.name}', value: ${to.pv_count}},
+                    </c:forEach>
+                ]
+            }
+        ]
+    };
+    myChart.setOption(option);
+</script>
+

结果如下:

结语

网上关于日志系统的几乎都是ELK,对于小网站的,隐私不是很重要的还是可以用用百度统计的,这套系统也折磨了我挺久的,特别是它那反人类的返回数据。期初本来是想使用百度统计的,后来考虑了一下ELK,尝试之后发现,服务器配置跑不起来,还是安安稳稳的使用了百度统计,于此做成了这个系统,美观度还是不高,颜色需要优化一下。最后,希望能在GitHub上给我个star吧。
日志系统地址:http://www.wenzhihuai.com/log.htmlopen in new window
个人网站网址:http://www.wenzhihuai.comopen in new window
个人网站代码地址:https://github.com/Zephery/newblogopen in new window
百度统计python代码地址:https://github.com/Zephery/baidutongjiopen in new window
万分感谢

+ + + diff --git "a/personalWebsite/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html" "b/personalWebsite/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html" new file mode 100644 index 00000000..9c617544 --- /dev/null +++ "b/personalWebsite/5.\345\260\217\351\233\206\347\276\244\351\203\250\347\275\262.html" @@ -0,0 +1,150 @@ + + + + + + + + + + 5.小集群部署.md | 个人博客 + + + + + +
跳至主要內容

5.小集群部署.md

Zephery约 2840 字大约 9 分钟

5.小集群部署.mdopen in new window

欢迎访问我的个人网站O(∩_∩)O哈哈~希望大佬们能给个star,个人网站网址:http://www.wenzhihuai.comopen in new window,个人网站代码地址:https://github.com/Zephery/newblogopen in new window
洋洋洒洒的买了两个服务器,用来学习分布式、集群之类的东西,整来整去,感觉分布式这种东西没人指导一下真的是太抽象了,先从网站的分布式部署一步一步学起来吧,虽然网站本身的访问量不大==。

nginx负载均衡

一般情况下,当单实例无法支撑起用户的请求时,就需要就行扩容,部署的服务器可以分机房、分地域。而分地域会导致请求分配到太远的地区,比如:深圳的用户却访问到了北京的节点,然后还得从北京返回处理之后的数据,光是来回就至少得30ms。这部分可以通过智能DNS(就近访问)解决。而分机房,需要将请求合理的分配到不同的服务器,这部分就是我们所需要处理的。
通常,负载均衡分为硬件和软件两种,硬件层的比较牛逼,将4-7层负载均衡功能做到一个硬件里面,如F5,梭子鱼等。目前主流的软件负载均衡分为四层和七层,LVS属于四层负载均衡,工作在tcp/ip协议栈上,通过修改网络包的ip地址和端口来转发, 由于效率比七层高,一般放在架构的前端。七层的负载均衡有nginx, haproxy, apache等,虽然nginx自1.9.0版本后也开始支持四层的负载均衡,但是暂不讨论(我木有硬件条件)。下图来自张开涛open in new window的《亿级流量网站架构核心技术》

本站并没有那么多的服务器,目前只有两台,搭建不了那么大型的架构,就简陋的用两台服务器来模拟一下负载均衡的搭建。下图是本站的简单架构:

其中服务器A(119.23.46.71)为深圳节点,服务器B(47.95.10.139)为北京节点,搭建Nginx之后流量是这么走的:user->A->B-A->user或者user->A->user,第一条中A将请求转发给B,然后B返回的是其运行结果的静态资源。因为这里仅仅是用来学习,所以请不要考虑因为地域导致延时的问题。。。。下面是过程。

1.1 Nginx的安装

可以选择tar.gz、yum、rpm安装等,这里,由于编译、nginx配置比较复杂,要是没有把握还是使用rpm来安装吧,比较简单。从https://pkgs.org/download/nginxopen in new window可以找到最新的rpm包,然后rpm -ivh 文件,然后在命令行中输入nginx即可启动,可以使用netstat检查一下端口。

启动后页面如下:

记一下常用命令

启动nginx,由于是采用rpm方式,所以环境变量什么的都配置好了。
+[root@beijingali ~]# nginx          #启动nginx
+[root@beijingali ~]# nginx -s reload         #重启nginx
+[root@beijingali ~]# nginx -t           #校验nginx配置文件
+nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
+nginx: configuration file /etc/nginx/nginx.conf test is successful
+

1.2 Nginx的配置

1.2.1 负载均衡算法

Nginx常用的算法有:
(1)round-robin:轮询,nginx默认的算法,从词语上可以看出,轮流访问服务器,也可以通过weight来控制访问次数。
(2)ip_hash:根据访客的ip,一个ip地址对应一个服务器。
(3)hash算法:hash算法常用的方式有根据uri、动态指定的consistent_key两种。
使用hash算法的缺点是当添加服务器的时候,只有少部分的uri能够被重新分配到新的服务器。这里,本站使用的是hash uri的算法,将不同的uri分配到不同的服务器,但是由于是不同的服务器,tomcat中的session是不一致,解决办法是tomcat sessionopen in new window的共享。额。。。可惜本站目前没有什么能够涉及到登陆什么session的问题。

http{
+    ...
+    upstream backend {
+        hash $uri;
+        # 北京节点
+        server 47.95.10.139:8080;
+        # 深圳节点
+        server 119.23.46.71:8080;
+    }
+
+    server {
+        ...
+        location / {
+            root   html;
+            index  index.html index.htm;
+            proxy_pass http://backend;
+            ...
+        }
+    ...
+

1.2.2 日志格式

之前有使用过ELK来跟踪日志,所以将日志格式化成了json的格式,这里贴一下吧

    ...
+    log_format main '{"@timestamp":"$time_iso8601",'
+                    '"host":"$server_addr",'
+                    '"clientip":"$remote_addr",'
+                    '"size":$body_bytes_sent,'
+                    '"responsetime":$request_time,'
+                    '"upstreamtime":"$upstream_response_time",'
+                    '"upstreamhost":"$upstream_addr",'
+                    '"http_host":"$host",'
+                    '"url":"$uri",'
+                    '"xff":"$http_x_forwarded_for",'
+                    '"referer":"$http_referer",'
+                    '"agent":"$http_user_agent",'
+                    '"status":"$status"}';
+    access_log  logs/access.log  main;
+    ...
+

1.2.3 HTTP反向代理

配置完上流服务器之后,需要配置Http的代理,将请求的端口转发到proxy_pass设定的上流服务器,即当我们访问http://wwww.wenzhihuai.com的时候open in new window,请求会被转发到backend中配置的服务器,此处为http://47.95.10.139:8080或者http://119.23.46.71:8080open in new window。但是,仔细注意之后,我们会发现,tomcat中的访问日志ip来源都是127.0.0.1,相当于本地访问自己的资源。由于后台中有处理ip的代码,对客户端的ip、访问uri等记录下来,所以需要设置nginx来获取用户的实际ip,参考nginx 配置open in new window。参考文中的一句话:经过反向代理后,由于在客户端和web服务器之间增加了中间层,因此web服务器无法直接拿到客户端的ip,通过remoteaddripnginxipnginx使remote_addr变量时获得的是用户的真实ip,如果我们想要在web端获得用户的真实ip,就必须在nginx这里作一个赋值操作,如下:

        location / {
+            root   html;
+            index  index.html index.htm;
+            proxy_pass http://backend;
+            proxy_set_header X-Real-IP $remote_addr;
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_set_header Host $host;
+            proxy_set_header REMOTE-HOST $remote_addr;
+        }
+

(1)proxy_set_header X-real-ip $remote_addr;
其中这个X-real-ip是一个自定义的变量名,名字可以随意取,这样做完之后,用户的真实ip就被放在X-real-ip这个变量里了,然后,在web端可以这样获取:
request.getAttribute("X-real-ip")

(2)proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

X-Forwarded-For:squid开发的,用于识别通过HTTP代理或负载平衡器原始IP一个连接到Web服务器的客户机地址的非rfc标准,这个不是默认有的,其经过代理转发之后,格式为client1, proxy1, proxy2,如果想通过这个变量来获取用户的ip,那么需要和proxy_add_x_forwarded_for一起使用。 proxy_add_x_forwarded_for:现在的proxy_add_x_forwarded_for变量,X-Forwarded-For部分包含的是用户的真实ip,remote_addr部分的值是上一台nginx的ip地址,于是通过这个赋值以后现在的X-Forwarded-For的值就变成了“用户的真实ip,第一台nginx的ip”。

1.2.4 HTTPS

HTTPSopen in new window(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的安全版。即HTTP下加入SSL层,HTTPS的安全基础是SSL,因此加密的详细内容就需要SSL。一般情况下,能通过服务器的ssh来生成ssl证书,但是如果使用是自己的,一般浏览器(谷歌、360等)都会报证书不安全的错误,正常用户都不敢访问吧==,所以现在使用的是腾讯跟别的机构颁发的:

首先需要下载证书,放在nginx.conf相同目录下,nginx上的配置也需要有所改变,在nginx.conf中设置listen 443 ssl;开启https。然后配置证书和私钥:

        ssl_certificate 1_www.wenzhihuai.com_bundle.crt;    #主要文件路径
+        ssl_certificate_key 2_www.wenzhihuai.com.key;
+        ssl_session_timeout 5m;         # 超时时间
+        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
+        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
+        ssl_prefer_server_ciphers on;
+

至此,可以使用https来访问了。https带来的安全性(保证信息安全、识别钓鱼网站等)是http远远不能比拟的,目前大部分网站都是实现全站https,还能将http自动重定向为https,此处,需要在server中添加rewrite ^(.*) https://$server_name$1 permanent;即可

1.2.5 失败重试

配置好了负载均衡之后,如果有一台服务器挂了怎么办?nginx中提供了可配置的服务器存活的识别,主要是通过max_fails失败请求次数,fail_timeout超时时间,weight为权重,下面的配置的意思是当服务器超时10秒,并失败了两次的时候,nginx将认为上游服务器不可用,将会摘掉上游服务器,fail_timeout时间后会再次将该服务器加入到存活上游服务器列表进行重试

upstream backend_server {
+    server 10.23.46.71:8080 max_fails=2 fail_timeout=10s weight=1;
+    server 47.95.10.139:8080 max_fails=2 fail_timeout=10s weight=1;
+}
+

session共享

分布式情况下难免会要解决session共享的问题,目前推荐的方法基本上都是使用redis,网上查找的方法目前流行的有下面四种,参考自tomcat 集群中 session 共open in new window
1.使用 filter 方法存储。(推荐,因为它的服务器使用范围比较多,不仅限于tomcat ,而且实现的原理比较简单容易控制。)
2.使用 tomcat sessionmanager 方法存储。(直接配置即可)
3.使用 terracotta 服务器共享。(不知道,不了解)
4.使用spring-session。(spring的一个小项目,其原理也和第一种基本一致)

本站使用spring-session,毕竟是spring下的子项目,学习下还是挺好的。参考Spring-Session官网open in new window。官方文档提供了spring-boot、spring等例子,可以参考参考。目前最新版本是2.0.0,不同版本使用方式不同,建议看官网的文档吧。

首先,添加相关依赖

        <dependency>
+            <groupId>org.springframework.session</groupId>
+            <artifactId>spring-session-data-redis</artifactId>
+            <version>1.3.1.RELEASE</version>
+            <type>pom</type>
+        </dependency>
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+            <version>${jedis.version}</version>
+        </dependency>
+

新建一个session.xml,然后在spring的配置文件中添加该文件,然后在session.xml中添加:

    <!-- redis -->
+    <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
+    </bean>
+
+    <bean id="jedisConnectionFactory"
+          class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
+        <property name="hostName" value="${host}" />
+        <property name="port" value="${port}" />
+        <property name="password" value="${password}" />
+        <property name="timeout" value="${timeout}" />
+        <property name="poolConfig" ref="jedisPoolConfig" />
+        <property name="usePool" value="true" />
+    </bean>
+
+    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
+        <property name="connectionFactory" ref="jedisConnectionFactory" />
+    </bean>
+
+    <!-- 将session放入redis -->
+    <bean id="redisHttpSessionConfiguration"
+          class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration">
+        <property name="maxInactiveIntervalInSeconds" value="1800" />
+    </bean>
+

然后我们需要保证servlet容器(tomcat)针对每一个请求都使用springSessionRepositoryFilter来拦截

<filter>
+    <filter-name>springSessionRepositoryFilter</filter-name>
+    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+</filter>
+<filter-mapping>
+    <filter-name>springSessionRepositoryFilter</filter-name>
+    <url-pattern>/*</url-pattern>
+    <dispatcher>REQUEST</dispatcher>
+    <dispatcher>ERROR</dispatcher>
+</filter-mapping>
+

配置完成,使用RedisDesktopManager查看结果:

测试:

访问http://www.wenzhihuai.comopen in new window
tail -f localhost_access_log.2017-11-05.txt查看日志,然后清空一下当前记录

访问技术杂谈页面,此时nginx将请求转发到119.23.46.71服务器,session为28424f91-5bc5-4bba-99ec-f725401d7318。

点击生活笔记页面,转发到的服务器为47.95.10.139,session为28424f91-5bc5-4bba-99ec-f725401d7318,与上面相同。session已保持一致。

值得注意的是:同一个浏览器,在没有关闭的情况下,即使通过域名访问和ip访问得到的session是不同的。
欢迎访问我的个人网站O(∩_∩)O哈哈~希望能给个star
个人网站网址:http://www.wenzhihuai.comopen in new window
个人网站代码地址:https://github.com/Zephery/newblogopen in new window

+ + + diff --git "a/personalWebsite/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html" "b/personalWebsite/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html" new file mode 100644 index 00000000..31bbb77f --- /dev/null +++ "b/personalWebsite/6.\346\225\260\346\215\256\345\272\223\345\244\207\344\273\275.html" @@ -0,0 +1,110 @@ + + + + + + + + + + 6.数据库备份 | 个人博客 + + + + + +
跳至主要內容

6.数据库备份

Zephery约 1722 字大约 6 分钟

6.数据库备份

先来回顾一下上一篇的小集群架构,tomcat集群,nginx进行反向代理,服务器异地:

由上一篇讲到,部署的时候,将war部署在不同的服务器里,通过spring-session实现了session共享,基本的分布式部署还算是完善了点,但是想了想数据库的访问会不会延迟太大,毕竟一个服务器在北京,一个在深圳,然后试着ping了一下:

果然,36ms。。。看起来挺小的,但是对比一下sql执行语句的时间:

大部分都能在10ms内完成,而最长的语句是insert语句,可见,由于异地导致的36ms延时还是比较大的,捣鼓了一下,最后还是选择换个架构,每个服务器读取自己的数据库,然后数据库底层做一下主主复制,让数据同步。最终架构如下:

一、MySql的复制

数据库复制的基本问题就是让一台服务器的数据与其他服务器保持同步。MySql目前支持两种复制方式:基于行的复制和基于语句的复制,这两者的基本过程都是在主库上记录二进制的日志、在备库上重放日志的方式来实现异步的数据复制。其过程分为三步:
(1)master将改变记录到二进制日志(binary log)中(这些记录叫做二进制日志事件,binary log events);
(2)slave将master的binary log events拷贝到它的中继日志(relay log);
(3)slave重做中继日志中的事件,将改变反映它自己的数据。

该过程的第一部分就是master记录二进制日志。在每个事务更新数据完成之前,master在二日志记录这些改变。MySQL将事务串行的写入二进制日志,即使事务中的语句都是交叉执行的。在事件写入二进制日志完成后,master通知存储引擎提交事务。
下一步就是slave将master的binary log拷贝到它自己的中继日志。首先,slave开始一个工作线程——I/O线程。I/O线程在master上打开一个普通的连接,然后开始binlog dump process。Binlog dump process从master的二进制日志中读取事件,如果已经跟上master,它会睡眠并等待master产生新的事件。I/O线程将这些事件写入中继日志。
SQL slave thread处理该过程的最后一步。SQL线程从中继日志读取事件,更新slave的数据,使其与master中的数据一致。只要该线程与I/O线程保持一致,中继日志通常会位于OS的缓存中,所以中继日志的开销很小。
此外,在master中也有一个工作线程:和其它MySQL的连接一样,slave在master中打开一个连接也会使得master开始一个线程。复制过程有一个很重要的限制——复制在slave上是串行化的,也就是说master上的并行更新操作不能在slave上并行操作。
MySql的基本复制方式有主从复制、主主复制,主主复制即把主从复制的配置倒过来再配置一遍即可,下面的配置则是主从复制的过程,到时候可自行改为主主复制。其他的架构如:一主库多备库、环形复制、树或者金字塔型都是基于这两种方式,可参考《高性能MySql》。

二、配置过程

2.1 创建所用的复制账号

由于是个自己的小网站,就不做过多的操作了,直接使用root账号

2.2 配置master

接下来要对mysql的serverID,日志位置,复制方式等进行操作,使用vim打开my.cnf。

[client]
+default-character-set=utf8
+
+[mysqld]
+character_set_server=utf8
+init_connect= SET NAMES utf8
+
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+
+symbolic-links=0
+
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
+# master
+log-bin=mysql-bin
+# 设为基于行的复制
+binlog-format=ROW
+# 设置server的唯一id
+server-id=2
+# 忽略的数据库,不使用备份
+binlog-ignore-db=information_schema
+binlog-ignore-db=cluster
+binlog-ignore-db=mysql
+# 要进行备份的数据库
+binlog-do-db=myblog
+

重启Mysql之后,查看主库状态,show master status。

其中,File为日志文件,指定Slave从哪个日志文件开始读复制数据,Position为偏移,从哪个POSITION号开始读,Binlog_Do_DB为要备份的数据库。

2.3 配置slave

从库的配置跟主库类似,vim /etc/my.cnf配置从库信息。


+[client]
+default-character-set=utf8
+
+[mysqld]
+character_set_server=utf8
+init_connect= SET NAMES utf8
+
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+
+symbolic-links=0
+
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
+
+# slave
+log-bin=mysql-bin
+# 服务器唯一id
+server-id=3
+# 不备份的数据库
+binlog-ignore-db=information_schema
+binlog-ignore-db=cluster
+binlog-ignore-db=mysql
+# 需要备份的数据库
+replicate-do-db=myblog
+# 其他相关信息
+slave-skip-errors=all
+slave-net-timeout=60
+# 开启中继日志
+relay_log         = mysql-relay-bin
+# 
+log_slave_updates = 1
+# 防止改变数据
+read_only         = 1
+

重启slave,同时启动复制,还需要调整一下命令。

mysql> CHANGE MASTER TO MASTER_HOST = '119.23.46.71', MASTER_USER = 'root', MASTER_PASSWORD = 'helloroot', MASTER_PORT = 3306, MASTER_LOG_FILE = 'mysql-bin.000009', MASTER_LOG_POS = 346180; 
+
+

可以看见slave已经开始进行同步了。我们使用show slave status\G来查看slave的状态。

其中日志文件和POSITION不一致是合理的,配置好了的话,即使重启,也不会影响到主从复制的配置。

某天在Github上漂游,发现了阿里的canal,同时才知道上面这个业务是叫异地跨机房同步,早期,阿里巴巴B2B公司因为存在杭州和美国双机房部署,存在跨机房同步的业务需求。不过早期的数据库同步业务,主要是基于trigger的方式获取增量变更,不过从2010年开始,阿里系公司开始逐步的尝试基于数据库的日志解析,获取增量变更进行同步,由此衍生出了增量订阅&消费的业务。下面是基本的原理:

原理相对比较简单:

1.canal模拟mysql slave的交互协议,伪装自己为mysql slave,向mysql master发送dump协议
2.mysql master收到dump请求,开始推送binary log给slave(也就是canal)
3.canal解析binary log对象(原始为byte流)

其中,配置过程如下:https://github.com/alibaba/canalopen in new window,可以搭配Zookeeper使用。在ZKUI中能够查看到节点:

一般情况下,还要配合阿里的另一个开源产品使用otteropen in new window,相关文档还是找找GitHub吧,个人搭建完了之后,用起来还是不如直接使用mysql的主主复制,而且异地机房同步这种大企业才有的业务。

公司又要996了,实在是忙不过来,感觉自己写的还是急躁了点,困==

+ + + diff --git "a/personalWebsite/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html" "b/personalWebsite/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html" new file mode 100644 index 00000000..63bad380 --- /dev/null +++ "b/personalWebsite/7.\351\202\243\344\272\233\347\211\233\351\200\274\347\232\204\346\217\222\344\273\266.html" @@ -0,0 +1,59 @@ + + + + + + + + + + 7.那些牛逼的插件 | 个人博客 + + + + + +
跳至主要內容

7.那些牛逼的插件

Zephery约 2161 字大约 7 分钟

7.那些牛逼的插件

欢迎访问我的网站http://www.wenzhihuai.com/open in new window 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblogopen in new window
建站的一开始,我也想自己全部实现,各种布局,各种炫丽的效果,想做点能让大家佩服的UI出来,但是,事实上,自己作为专注Java的程序员,前端的东西一碰脑子就有“我又不是前端,浪费时间在这合适么?”这种想法,捣鼓来捣鼓去,做出的东西实在是没法看,我就觉得,如果自己的“产品”连自己都看不下去了,那还好意思给别人看?特别是留言板那块,初版的页面简直low的要死。所以,还是踏踏实实的“站在巨人的肩膀上”吧,改用别人的插件。但不要纯粹的使用别人的博客模板了,如hexo,wordpress这些,就算是自己拼凑过来的也比这些强。下面是本博客中所用到的插件,给大家介绍介绍,共同学习学习。
本站主要用到的插件有:
1.wowslider
2.畅言
3.Editor.mdopen in new window
4.highchart、echart
5.百度分享
6.waterfall.js
7.心知天气
8.标签云

wowslider

可能是我这网站中最炫的东西了,图片能够自动像幻灯片一样自动滚动,让网站的首页一看起来就高大上,简直就是建站必备的东西,而且安装也及其简单,有兴趣可以点击官网open in new window看看。GitHub里也开放了源代码open in new window。安装过程:自己选择“幻灯片”切换效果,保存为html就行了,WORDPREESS中好像有集成这个插件的,做的还更好。感兴趣可以点击我的博客首页open in new window看一看。

不过还有个值得注意的问题,就是wowslider里面带有一个googleapis的服务,即https://fonts.googleapis.com/css?family=Arimo&subset=latin,cyrillic,latin-ext,由于一般用户不能访问谷歌,会导致网页加载速度及其缓慢,所以,去掉为妙open in new window

畅言

作为社交评论的工具,虽然说表示还是想念以前的多说,但是畅言现在做得还是好了,有评论审核,评论导出导入等功能,如果浏览量大的话,还能提供广告服务,让站长也能拿到一丢丢的广告费。本博客中使用了畅言的基本评论、获取某篇文章评论数的功能。可以到我这里留言open in new window

Editor.mdopen in new window

一款能将markdown解析为html的插件,国人的作品,博客的文章编辑器一开始想使用的是markdown,想法是:写文章、保存数据库都是markdown格式的,保存在数据库中,读取时有需要解析markdown,这个过程是有点耗时的,但是相比把html式的网页保存在数据库中友好点吧,因为如果一篇文章比较长的话,转成html的格式,光是大小估计也得超过几十kb?所以,还是本人选择的是一切都用源markdown。
editor.mdopen in new window,是一款开源的、可嵌入的 Markdown 在线编辑器(组件),基于 CodeMirror、jQuery 和 Marked 构建。页面看起来还是美观的,相比WORDPRESS的那些牛逼插件还差那么一点点,不过从普通人的眼光来看,应该是可以的了。此处,我用它作为解析网页的利器,还有就是后台编辑也是用的这个。

代码样式,这一点是不如WORDPRESS的插件了,不过已经可以了。

图表

目前最常用的是highcharts跟echart,目前个人博客中的日志系统主要还是采用了highcharts,主要还是颜色什么的格调比较相符吧,其次是因为对echarts印象不太友好,比如下面做这张,打开网页后,缩小浏览器,百度的地域图却不能自适应,出现了越界,而highcharts的全部都能自适应调整。想起有次面试,我说我用的highcharts,面试官一脸嫌弃。。。(网上这么多人鄙视百度是假的?)

不过地图确确实实是echarts的优势,毕竟还是自家的东西了解自家,不过前段时间去看了看echarts的官网,已经不提供下载了。如果有需要,还是去csdn上搜索吧,或者替换为highmap。

百度分享

作为一个以博客为主的网站,免不了使用一些社会化分享的工具,目前主要是jiathisopen in new window和百度分享,这两者的ui都是相似的(丑爆了)。凭我个人的感觉,jiathis加载实在是太过于缓慢,这点是无法让人忍受的,只好投靠百度。百度分享类似于jiathis,安装也很简单,具体见官网http://share.baidu.com/code/advance#toolsopen in new window。一直点点点,配置完之后,就是下图这种,丑爆了是不是?

好在对它的美观改变不是很难,此处参考了别人的UI设计,原作者我忘记怎么联系他了。其原理主要是使用图片来替换掉原本的东西。完整的源码可以点击此处open in new window

#share a {
+    width: 34px;
+    height: 34px;
+    padding: 0;
+    margin: 6px;
+    border-radius: 25px;
+    transition: all .4s;
+}
+/*主要的是替换掉backgound的背景图片*/
+#share a.bds_qzone {
+    background: url(http://image.wenzhihuai.com/t_QQZone.png) no-repeat;
+    background-size: 34px 34px;
+}
+

改完之后的效果。

瀑布流

有段时间,瀑布流特别流行?还有段时间,瀑布流开始遭到各种抵制。。。看看知乎的人怎么说open in new window,大部分人不喜欢的原因是让人觉得视觉疲劳,不过瀑布流最大的好处还是有的:提高发现好图的效率以及图片列表页极强的视觉感染力。没错,我还是想把自己的网站弄得铉一些==,所以采用了瀑布流(不过效果不是很好,某些浏览器甚至加载出错),这个大bug有时间再改,毕竟花了很多时间做的这个,效果确实不咋地。目前主要的瀑布流有waterfall.jsmasory.js。这一块目前还不是很完善,希望能得到各位大佬的指点。

天气插件

此类咨询服务还是网上还是挺多的,这一块不知道是不是所谓的“画蛇添足”这部分,主要是我觉得网站右边这部分老是少了点什么,所以加上了天气插件。目前常用的天气插件有中国天气网open in new window心知天气open in new window等。安装方式见各自的官网,这里不再阐述,我使用的是心知天气。注意:心知天气限制流量的,一个小时内只能使用400次,如果超出了会失效,当然也可以付费使用。

标签云

标签云,弄得好的话应该说是一个网站的点缀。现在好像比较流行3D的标签云?像下面这种。

从个人的网站风格来看,比较适应PHP形式的,有点颜色而又不绚丽的即可,之前用的跟分类的一样的样式,即双纵列的样式,美观度还行,虽然老是感觉有点怪怪的,如果某个标签的字数过长怎么办,岂不是要顶出div了。所以还是选择换另一种风格,最终偶然一次找到了下面这种,能够自适应宽度,颜色虽然鲜艳了点(以后有空再调一下吧),源码见style.cssopen in new window。 下图为目前的标签页。

总结

作为一个后端人员,调css和js真是痛苦==,好在坚持下来了,虽然还是很多不足,以后有时间慢慢改。说了那么多,感觉自己还是菜的抠脚。
题外话,搭建一个博客,对于一个新近程序员来说真的是锻炼自己的一个好机会,能够认识到从前端、java后台、linux、jvm等等知识,只是真的有点耗时间(还不如把时间耗在Spring源码),如果不采用别人的框架的话,付出的代价还是蛮大的(所以不要鄙视我啦)。没有什么能够一举两得,看自己的取舍吧。加油💪(ง •_•)ง

欢迎访问我的网站http://www.wenzhihuai.com/open in new window 。感谢,如果可以,希望能在GitHub上给个star,GitHub地址https://github.com/Zephery/newblogopen in new window

+ + + diff --git "a/personalWebsite/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html" "b/personalWebsite/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html" new file mode 100644 index 00000000..58e83e97 --- /dev/null +++ "b/personalWebsite/8.\345\237\272\344\272\216\350\264\235\345\217\266\346\226\257\347\232\204\346\203\205\346\204\237\345\210\206\346\236\220.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 8.基于贝叶斯的情感分析 | 个人博客 + + + + + + + + + diff --git "a/personalWebsite/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html" "b/personalWebsite/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html" new file mode 100644 index 00000000..a8cacb6f --- /dev/null +++ "b/personalWebsite/9.\347\275\221\347\253\231\346\200\247\350\203\275\344\274\230\345\214\226.html" @@ -0,0 +1,46 @@ + + + + + + + + + + 9.网站性能优化 | 个人博客 + + + + + + + + + diff --git a/personalWebsite/index.html b/personalWebsite/index.html new file mode 100644 index 00000000..b82346c0 --- /dev/null +++ b/personalWebsite/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git a/redis/index.html b/redis/index.html new file mode 100644 index 00000000..50396f51 --- /dev/null +++ b/redis/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 个人博客 + + + + + + + + + diff --git "a/redis/redis\347\274\223\345\255\230.html" "b/redis/redis\347\274\223\345\255\230.html" new file mode 100644 index 00000000..e67ab4c2 --- /dev/null +++ "b/redis/redis\347\274\223\345\255\230.html" @@ -0,0 +1,138 @@ + + + + + + + + + + 一、概述 | 个人博客 + + + + + +
跳至主要內容

一、概述

Zephery约 3588 字大约 12 分钟

一、概述

1.1 缓存介绍

系统的性能指标一般包括响应时间、延迟时间、吞吐量,并发用户数和资源利用率等。在应用运行过程中,我们有可能在一次数据库会话中,执行多次查询条件完全相同的SQL,MyBatis提供了一级缓存的方案优化这部分场景,如果是相同的SQL语句,会优先命中一级缓存,避免直接对数据库进行查询,提高性能。
缓存常用语:
数据不一致性、缓存更新机制、缓存可用性、缓存服务降级、缓存预热、缓存穿透
可查看Redis实战(一) 使用缓存合理性open in new window

1.2 本站缓存架构

从没有使用缓存,到使用mybatis缓存,然后使用了ehcache,再然后是mybatis+redis缓存。

步骤:
(1)用户发送一个请求到nginx,nginx对请求进行分发。
(2)请求进入controller,service,service中查询缓存,如果命中,则直接返回结果,否则去调用mybatis。
(3)mybatis的缓存调用步骤:二级缓存->一级缓存->直接查询数据库。
(4)查询数据库的时候,mysql作了主主备份。

二、Mybatis缓存

2.1 mybatis一级缓存

Mybatis的一级缓存是指Session回话级别的缓存,也称作本地缓存。一级缓存的作用域是一个SqlSession。Mybatis默认开启一级缓存。在同一个SqlSession中,执行相同的查询SQL,第一次会去查询数据库,并写到缓存中;第二次直接从缓存中取。当执行SQL时两次查询中间发生了增删改操作,则SqlSession的缓存清空。Mybatis 默认支持一级缓存,不需要在配置文件中配置。

我们来查看一下源码的类图,具体的源码分析简单概括一下:SqlSession实际上是使用PerpetualCache来维护的,PerpetualCache中定义了一个HashMap来进行缓存。
(1)当会话开始时,会创建一个新的SqlSession对象,SqlSession对象中会有一个新的Executor对象,Executor对象中持有一个新的PerpetualCache对象;
(2)对于某个查询,根据statementId,params,rowBounds来构建一个key值,根据这个key值去缓存Cache中取出对应的key值存储的缓存结果。如果命中,则返回结果,如果没有命中,则去数据库中查询,再将结果存储到cache中,最后返回结果。如果执行增删改,则执行flushCacheIfRequired方法刷新缓存。
(3)当会话结束时,SqlSession对象及其内部的Executor对象还有PerpetualCache对象也一并释放掉。

2.2 mybatis二级缓存

Mybatis的二级缓存是指mapper映射文件,为Application应用级别的缓存,生命周期长。二级缓存的作用域是同一个namespace下的mapper映射文件内容,多个SqlSession共享。Mybatis需要手动设置启动二级缓存。在同一个namespace下的mapper文件中,执行相同的查询SQL。实现二级缓存,关键是要对Executor对象做文章,Mybatis给Executor对象加上了一个CachingExecutor,使用了设计模式中的装饰者模式,

2.2.1 MyBatis二级缓存的划分

MyBatis并不是简单地对整个Application就只有一个Cache缓存对象,它将缓存划分的更细,即是Mapper级别的,即每一个Mapper都可以拥有一个Cache对象,具体如下:
a.为每一个Mapper分配一个Cache缓存对象;
b.多个Mapper共用一个Cache缓存对象;

2.2.2 二级缓存的开启

在mybatis的配置文件中添加:

<settings>
+   <!--开启二级缓存-->
+    <setting name="cacheEnabled" value="true"/>
+</settings>
+

然后再需要开启二级缓存的mapper.xml中添加(本站使用了LRU算法,时间为120000毫秒):

    <cache eviction="LRU"
+           type="org.apache.ibatis.cache.impl.PerpetualCache"
+           flushInterval="120000"
+           size="1024"
+           readOnly="true"/>
+

2.2.3 使用第三方支持的二级缓存的实现

MyBatis对二级缓存的设计非常灵活,它自己内部实现了一系列的Cache缓存实现类,并提供了各种缓存刷新策略如LRU,FIFO等等;另外,MyBatis还允许用户自定义Cache接口实现,用户是需要实现org.apache.ibatis.cache.Cache接口,然后将Cache实现类配置在节点的type属性上即可;除此之外,MyBatis还支持跟第三方内存缓存库如Memecached、Redis的集成,总之,使用MyBatis的二级缓存有三个选择:

  1. MyBatis自身提供的缓存实现;
  2. 用户自定义的Cache接口实现;
  3. 跟第三方内存缓存库的集成;
    具体的实现,可参照:SpringMVC + MyBatis + Mysql + Redis(作为二级缓存) 配置open in new window

MyBatis中一级缓存和二级缓存的组织如下图所示(图片来自深入理解mybatis原理open in new window):

2.3 Mybatis在分布式环境下脏读问题

(1)如果是一级缓存,在多个SqlSession或者分布式的环境下,数据库的写操作会引起脏数据,多数情况可以通过设置缓存级别为Statement来解决。
(2)如果是二级缓存,虽然粒度比一级缓存更细,但是在进行多表查询时,依旧可能会出现脏数据。
(3)Mybatis的缓存默认是本地的,分布式环境下出现脏读问题是不可避免的,虽然可以通过实现Mybatis的Cache接口,但还不如直接使用集中式缓存如Redis、Memcached好。

下面将介绍使用Redis集中式缓存在个人网站的应用。

三、Redis缓存

Redis运行于独立的进程,通过网络协议和应用交互,将数据保存在内存中,并提供多种手段持久化内存的数据。同时具备服务器的水平拆分、复制等分布式特性,使得其成为缓存服务器的主流。为了与Spring更好的结合使用,我们使用的是Spring-Data-Redis。此处省略安装过程和Redis的命令讲解。

3.1 Spring Cache

Spring 3.1 引入了激动人心的基于注释(annotation)的缓存(cache)技术,它本质上不是一个具体的缓存实现方案(例如EHCache 或者 OSCache),而是一个对缓存使用的抽象,通过在既有代码中添加少量它定义的各种 annotation,即能够达到缓存方法的返回对象的效果。Spring 的缓存技术还具备相当的灵活性,不仅能够使用 **SpEL(Spring Expression Language)**来定义缓存的 key 和各种 condition,还提供开箱即用的缓存临时存储方案,也支持和主流的专业缓存例如 EHCache 集成。
下面是Spring Cache常用的注解:

(1)@Cacheable
@Cacheable 的作用 主要针对方法配置,能够根据方法的请求参数对其结果进行缓存

属性介绍例子
value缓存的名称,必选@Cacheable(value=”mycache”) 或者@Cacheable(value={”cache1”,”cache2”}
key缓存的key,可选,需要按照SpEL表达式填写@Cacheable(value=”testcache”,key=”#userName”)
condition缓存的条件,可以为空,使用 SpEL 编写,只有为 true 才进行缓存@Cacheable(value=”testcache”,key=”#userName”)

(2)@CachePut
@CachePut 的作用 主要针对方法配置,能够根据方法的请求参数对其结果进行缓存,和 @Cacheable 不同的是,它每次都会触发真实方法的调用

属性介绍例子
value缓存的名称,必选@Cacheable(value=”mycache”) 或者@Cacheable(value={”cache1”,”cache2”}
key缓存的key,可选,需要按照SpEL表达式填写@Cacheable(value=”testcache”,key=”#userName”)
condition缓存的条件,可以为空,使用 SpEL 编写,只有为 true 才进行缓存@Cacheable(value=”testcache”,key=”#userName”)

(3)@CacheEvict
@CachEvict 的作用 主要针对方法配置,能够根据一定的条件对缓存进行清空

属性介绍例子
value缓存的名称,必选@Cacheable(value=”mycache”) 或者@Cacheable(value={”cache1”,”cache2”}
key缓存的key,可选,需要按照SpEL表达式填写@Cacheable(value=”testcache”,key=”#userName”)
condition缓存的条件,可以为空,使用 SpEL 编写,只有为 true 才进行缓存@Cacheable(value=”testcache”,key=”#userName”)
allEntries是否清空所有缓存内容,默认为false@CachEvict(value=”testcache”,allEntries=true)
beforeInvocation是否在方法执行前就清空,缺省为 false@CachEvict(value=”testcache”,beforeInvocation=true)

但是有个问题:
Spring官方认为:缓存过期时间由各个产商决定,所以并不提供缓存过期时间的注解。所以,如果想实现各个元素过期时间不同,就需要自己重写一下Spring cache。

3.2 引入包

一般是Spring常用的包+Spring data redis的包,记得注意去掉所有冲突的包,之前才过坑,Spring-data-MongoDB已经有SpEL的库了,和自己新引进去的冲突,搞得我以为自己是配置配错了,真是个坑,注意,开发过程中一定要去除掉所有冲突的包!!!

3.3 ApplicationContext.xml

需要启用缓存的注解开关,并配置好Redis。序列化方式也要带上,否则会碰到幽灵bug。

    <!-- 启用缓存注解开关,此处可自定义keyGenerator -->
+    <cache:annotation-driven/>
+    <bean id="jedisConnectionFactory"
+          class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
+        <property name="hostName" value="${host}"/>
+        <property name="port" value="${port}"/>
+        <property name="password" value="${password}"/>
+        <property name="database" value="${redis.default.db}"/>
+        <property name="timeout" value="${timeout}"/>
+        <property name="poolConfig" ref="jedisPoolConfig"/>
+        <property name="usePool" value="true"/>
+    </bean>
+    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
+        <property name="connectionFactory" ref="jedisConnectionFactory"/>
+        <!-- 序列化方式 建议key/hashKey采用StringRedisSerializer。 -->
+        <property name="keySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="hashKeySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="valueSerializer">
+            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
+        </property>
+        <property name="hashValueSerializer">
+            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
+        </property>
+    </bean>
+    <bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
+        <constructor-arg name="redisOperations" ref="redisTemplate" />
+        <!--统一过期时间-->
+        <property name="defaultExpiration" value="${redis.defaultExpiration}"/>
+    </bean>
+

3.5 自定义KeyGenerator

在分布式系统中,很容易存在不同类相同名字的方法,如A.getAll(),B.getAll(),默认的key(getAll)都是一样的,会很容易产生问题,所以,需要自定义key来实现分布式环境下的不同。

@Component("customKeyGenerator")
+public class CustomKeyGenerator implements KeyGenerator {
+    @Override
+    public Object generate(Object o, Method method, Object... objects) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(o.getClass().getName());
+        sb.append(".");
+        sb.append(method.getName());
+        for (Object obj : objects) {
+            sb.append(obj.toString());
+        }
+        return sb.toString();
+    }
+}
+

之后,存储的key就变为:com.myblog.service.impl.BlogServiceImpl.getBanner。

3.4 添加注解

在所需要的方法上添加注解,比如,首页中的那几张幻灯片,每次进入首页都需要查询数据库,这里,我们直接放入缓存里,减少数据库的压力,还有就是那些热门文章,访问量比较大的,也放进数据库里。

    @Override
+    @Cacheable(value = "getBanner", keyGenerator = "customKeyGenerator")
+    public List<Blog> getBanner() {
+        return blogMapper.getBanner();
+    }
+    @Override
+    @Cacheable(value = "getBlogDetail", key = "'blogid'.concat(#blogid)")
+    public Blog getBlogDetail(Integer blogid) {
+        Blog blog = blogMapper.selectByPrimaryKey(blogid);
+        if (blog == null) {
+            return null;
+        }
+        Category category = categoryMapper.selectByPrimaryKey(blog.getCategoryid());
+        blog.setCategory(category);
+        List<Tag> tags = tagMapper.getTagByBlogId(blog.getBlogid());
+        blog.setTags(tags.size() > 0 ? tags : null);
+        asyncService.updatebloghits(blogid);//异步更新阅读次数
+        logger.info("没有走缓存");
+        return blog;
+    }
+

3.5 测试

我们调用一个getBlogDetail(获取博客详情)100次来对比一下时间。连接的数据库在深圳,本人在广州,还是有那么一丢丢的网路延时的。

public class SpringTest {
+    @Test
+    public void init() {
+        ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath:spring-test.xml");
+        IBlogService blogService = (IBlogService) ctx.getBean("blogService");
+        long startTime = System.currentTimeMillis();
+        for (int i = 0; i < 100; i++) {
+            blogService.getBlogDetail(615);
+        }
+        System.out.println(System.currentTimeMillis() - startTime);
+    }
+}
+

为了做一下对比,我们同时使用mybatis自身缓存来进行测试。

3.6 实验结果

统计出结果如下:

没有使用任何缓存(mybatis一级缓存没有关闭):18305
+使用远程Redis缓存:12727
+使用Mybatis缓存:6649
+使用本地Redis缓存:5818
+

由结果看出,缓存的使用大大较少了获取数据的时间。

部署进个人博客之后,redis已经缓存的数据:

3.7 分页的数据怎么办

个人网站中共有两个栏目,一个是技术杂谈,另一个是生活笔记,每点击一次栏目的时候,会根据页数从数据库中查询数据,百度了下,大概有三种方法:
(1)以页码作为Key,然后缓存整个页面。
(2)分条存取,只从数据库中获取分页的文章ID序列,然后从service(缓存策略在service中实现)中获取。
第一种,由于使用了第三方的插件PageHelper,分页获取的话会比较麻烦,同时整页缓存对内存压力也蛮大的,毕竟服务器只有2g。第二条实现方式简单,缺陷是依旧需要查询数据库,想了想还是放弃了。缓存的初衷是对请求频繁又不易变的数据,实际使用中很少会反复的请求同一页的数据(查询条件也相同),当然对数据中某些字段做缓存还是有必要的。

四、如何解决脏读?

对于文章来说,内容是不经常更新的,没有涉及到缓存一致性,但是对于文章的阅读量,用户每点击一次,就应该更新浏览量的。对于文章的缓存,常规的设计是将文章存储进数据库中,然后读取的时候放入缓存中,然后将浏览量以文章ID+浏览量的结构实时的存入redis服务器中。本站当初设计不合理,直接将浏览量作为一个字段,用户每点击一次的时候就异步更新浏览量,但是此处没有更新缓存,如果手动更新缓存的话,基本上每点击一次都得执行更新操作,同样也不合理。所以,目前本站,你们在页面上看到的浏览量和数据库中的浏览量并不是一致的。有兴趣的可以点击我的网站open in new window玩玩~~

五、题外话

兄弟姐妹们啊,个人网站只是个小项目,纯属为了学习而用的,文章可以看看,但是,就不要抓取了吧。。。。一个小时抓取6万次宝宝心脏真的受不了,虽然服务器一切都还稳定==

个人网站http://www.wenzhihuai.comopen in new window
个人网站源码,希望能给个starhttps://github.com/Zephery/newblogopen in new window

参考:
1.《深入理解mybatis原理》 MyBatis的一级缓存实现详解open in new window
2.《深入理解mybatis原理》 MyBatis的二级缓存的设计原理open in new window
3.聊聊Mybatis缓存机制open in new window
4.Spring思维导图open in new window
5.SpringMVC + MyBatis + Mysql + Redis(作为二级缓存) 配置open in new window
6.《深入分布式缓存:从原理到实践》

+ + + diff --git a/robots.txt b/robots.txt new file mode 100644 index 00000000..e509a58e --- /dev/null +++ b/robots.txt @@ -0,0 +1,5 @@ + +User-agent:* +Disallow: + +Sitemap: http://www.wenzhihuai.com/sitemap.xml diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 00000000..6112797f --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,3 @@ + + +http://www.wenzhihuai.com/2024-01-25T11:46:04.000Zdailyhttp://www.wenzhihuai.com/home.html2024-01-25T11:46:04.000Zdailyhttp://www.wenzhihuai.com/cloudnative/2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/bigdata/2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/database/2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/devops/2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/devops/devops-ping-tai.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/devops/gitlab-ci.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/devops/jenkins-x.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/devops/tekton.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/donate/2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/interview/jvm.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/interview/kafka.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/interview/kubernetes.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/interview/mysql.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/interview/tiktok2023.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/java/JVM%E8%B0%83%E4%BC%98%E5%8F%82%E6%95%B0.html2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/java/lucene%E6%90%9C%E7%B4%A2%E5%8E%9F%E7%90%86.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/java/serverlog.html2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/java/%E4%B8%80%E6%AC%A1jvm%E8%B0%83%E4%BC%98%E8%BF%87%E7%A8%8B.html2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/java/%E5%86%85%E5%AD%98%E5%B1%8F%E9%9A%9C.html2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/java/%E5%9C%A8%20Spring%206%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%99%9A%E6%8B%9F%E7%BA%BF%E7%A8%8B.html2024-01-25T13:13:41.000Zdailyhttp://www.wenzhihuai.com/java/%E5%9F%BA%E4%BA%8Ekubernetes%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%99%90%E6%B5%81.html2024-01-25T13:13:41.000Zdailyhttp://www.wenzhihuai.com/kafka/2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/kubernetes/2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/kubernetes/spark%20on%20k8s%20operator.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/life/2017.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/life/2018.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/life/2019.html2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/life/2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/open-source-project/2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/others/chatgpt.html2024-01-25T12:53:13.000Zdailyhttp://www.wenzhihuai.com/others/tesla.html2024-01-25T12:53:13.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/1.%E5%8E%86%E5%8F%B2%E4%B8%8E%E6%9E%B6%E6%9E%84.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/10.%E7%BD%91%E7%AB%99%E9%87%8D%E6%9E%84.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/2.Lucene%E7%9A%84%E4%BD%BF%E7%94%A8.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/3.%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/4.%E6%97%A5%E5%BF%97%E7%B3%BB%E7%BB%9F.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/5.%E5%B0%8F%E9%9B%86%E7%BE%A4%E9%83%A8%E7%BD%B2.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/6.%E6%95%B0%E6%8D%AE%E5%BA%93%E5%A4%87%E4%BB%BD.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/7.%E9%82%A3%E4%BA%9B%E7%89%9B%E9%80%BC%E7%9A%84%E6%8F%92%E4%BB%B6.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/8.%E5%9F%BA%E4%BA%8E%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%9A%84%E6%83%85%E6%84%9F%E5%88%86%E6%9E%90.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/9.%E7%BD%91%E7%AB%99%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/personalWebsite/2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/redis/2024-01-24T03:25:58.000Zdailyhttp://www.wenzhihuai.com/redis/redis%E7%BC%93%E5%AD%98.html2024-01-24T11:34:08.000Zdailyhttp://www.wenzhihuai.com/bigdata/spark/2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/bigdata/spark/elastic-spark.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/database/elasticsearch/2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/database/elasticsearch/elasticsearch%E6%BA%90%E7%A0%81debug.html2024-01-25T13:13:41.000Zdailyhttp://www.wenzhihuai.com/database/elasticsearch/%E3%80%90elasticsearch%E3%80%91%E6%90%9C%E7%B4%A2%E8%BF%87%E7%A8%8B%E8%AF%A6%E8%A7%A3.html2024-01-25T13:13:41.000Zdailyhttp://www.wenzhihuai.com/database/mysql/1mysql.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/database/mysql/2024-01-24T10:30:22.000Zdailyhttp://www.wenzhihuai.com/database/mysql/gap%E9%94%81.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/database/mysql/%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92explain.html2024-01-25T11:42:16.000Zdailyhttp://www.wenzhihuai.com/database/mysql/%E6%95%B0%E6%8D%AE%E5%BA%93%E7%BC%93%E5%AD%98.html2024-01-25T11:42:16.000Zdaily \ No newline at end of file diff --git a/sitemap.xsl b/sitemap.xsl new file mode 100644 index 00000000..8ad0f233 --- /dev/null +++ b/sitemap.xsl @@ -0,0 +1,152 @@ + + + + + + + XML Sitemap + + + + +

XML Sitemap

+
+ + + + + + + + + + + + + + + + + + + + + + +
URLs list
+ + PriorityChange FrequencyLast Updated Time
+ + + + + + + + + + + + + 0.5 + + + + + + + + + - + + + + +
+
+ + + +
+
diff --git a/star/index.html b/star/index.html new file mode 100644 index 00000000..408258fe --- /dev/null +++ b/star/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 星标 | 个人博客 + + + + + + + + + diff --git a/tag/index.html b/tag/index.html new file mode 100644 index 00000000..bd23627b --- /dev/null +++ b/tag/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 标签 | 个人博客 + + + + + + + + + diff --git a/timeline/index.html b/timeline/index.html new file mode 100644 index 00000000..daa2df13 --- /dev/null +++ b/timeline/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + 时间轴 | 个人博客 + + + + + + + + +