0%

磁盘挂载

  1. Get the UUID of the partition

    sudo blkid

  2. Add partition to fstab

    1
    2
    # /data was on /dev/sda3
    UUID=0009091A00027E42 /data ntfs defaults,iocharset=utf8,fmask=111,dmask=002 0 2

deepin wine

百度网盘id

  • 一直停留在登录界面

    1
    删除 ~/baidunetdisk文件夹,再次启动即可

光驱相关

CDROM, DVD 这些设备现在来说都是属于古董了,但因为有些第三方软件是以CDROM的形式提供的,所以有时候还会遇到如何挂载的问题?

在Ubuntu Server 18.04中,要挂载 CDROM(DVD)可以遵循以下步骤:

挂载 CDROM(DVD)

  1. 确认设备文件名, 进入 dev 目录, 执行:
1
2
cd /dev
ls -lt | less

系统显示一个设备列表,可以看到其中有两个特别的,分别是:

1
2
cdrom -> sr0
dvd -> sr0

说明系统已经将 cdrom, dvd 命名为 sr0 的别名,其实是同一个设备。

  1. 执行 mount 命令挂载cdrom, 因为 ubuntu server 18.04中,已经在根目录下建了一个名为 cdrom 的目录,我们就使用这个目录来挂载,执行:
1
sudo mount /dev/cdrom /cdrom

卸载 CDROM (DVD)

要想卸载 CDROM, 可以简单的执行:

1
sudo umount /cdrom

如果是想推出当前的光盘,则可以执行:

1
sudo eject /cdrom

postgre

在本机安装,非docker,user: postgres pw:postgres

1
sudo -u postgres psql

更改 Ubuntu 18.04 登陆背景

  1. sudo vi /etc/alternatives/gdm3.css

  2. 修改 CSS 文件内容

    1
    2
    3
    4
    5
    6
    #lockDialogGroup {
    background: url(/*自己喜欢的图片的路径。注意,不需要resource://开头*/);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    }

配合electron-ssr进行终端外网访问

/etc/profile中添加配置

1
2
export http_proxy="http://127.0.0.1:12333"
export https_proxy="http://127.0.0.1:12333"

然后source /etc/profile即可

升级到2204版本中文输入法只在终端可用解决

参考:https://zhuanlan.zhihu.com/p/508797663

  • /etc/profile 添加
1
2
3
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
  • ~/.pam_environment 添加以下几行:
1
2
3
4
GTK_IM_MODULE DEFAULT=fcitx
QT_IM_MODULE DEFAULT=fcitx
XMODIFIERS DEFAULT=@im=fcitx
SDL_IM_MODULE DEFAULT=fcitx

roles

1
2
3
defaults    参数
tasks 启动脚本
templates 配置文档

Issues 搜索

searchKeyWord is:issue is:closed repo:Alamofire/Alamofire 

这条搜索,searchKeyWord是搜索关键字, is:issue 表示我们要搜索 issue, is:closed 表示已经关闭的 issue, repo:Alamofire/Alamofire 表示我们只搜索这个仓库范围的 issue

堆内与堆外

  • 常说的堆,指的是堆内内存,由JVM「托管」的内存区域。对应的英文是:on-heap Memory。所有的对象都是放在堆中。

  • 堆的特点:

    • 由GC管理,一旦堆大小大于1GB会出现比较明显的暂停。
    • 对象存储到GC中无需进行序列化、反序列化的。

堆外

  • 堆外就是JVM开辟出来的,堆以外的一块「非托管」内存区域。对应的英文是:off-heap Memory。堆外内存也是 JVM 进程开辟的一块内存空间。只不过,GC不会「光顾」这里。

  • 堆外的特点:

    • 由操作系统直接管理。别的进程能够直接访问。
    • 特别适合分配次数少,读写非常频繁的场景。
    • 可以避免在分配GB级别的内存而造成GC开销。
  • 堆外的缺点:

    • 容易出现内存泄漏,难以排查。
    • 对象的存储需要序列化、和反序列化。

因为堆外内存由此特点,很多高性能的应用组件基于off-heap来提高性能。

堆外内存常配合使用System GC

堆外内存主要针对java.nio.DirectByteBuffer,这些对象的创建过程会通过Unsafe接口直接通过os::malloc来分配内存,然后将内存的起始地址和大小存到java.nio.DirectByteBuffer对象里,这样就可以直接操作这些内存。这些内存只有在DirectByteBuffer回收掉之后才有机会被回收,因此如果这些对象大部分都移到了old,但是一直没有触发CMS GC或者Full GC,那么悲剧将会发生,因为你的物理内存被他们耗尽了,因此为了避免这种悲剧的发生,通过-XX:MaxDirectMemorySize来指定最大的堆外内存大小,当使用达到了阈值的时候将调用System.gc来做一次full gc,以此来回收掉没有被使用的堆外内存。

System.gc常识

  • system.gc其实是做一次full gc
  • system.gc会暂停整个进程
  • system.gc一般情况下我们要禁掉,使用-XX:+DisableExplicitGC
  • system.gc在cms gc下我们通过-XX:+ExplicitGCInvokesConcurrent来做一次稍微高效点的GC(效果比Full GC要好些)
  • system.gc最常见的场景是RMI/NIO下的堆外内存分配等

jvm常用参数的设置和含义

1.设置堆的最大和最小值
-Xmx20M(最大值) ,-Xms20M(最小值)。

1
-Xms和-Xmx实际上是 -XX:InitialHeapSize 和-XX:MaxHeapSize 的缩写

2.设置栈的大小
-Xss128k: 设置每个线程的堆栈大小。JDK5.0以后每个线程堆栈大小为1M,以前每个线程堆栈大小为256K。更具应用的线程所需内存大小进行调整。在相同物理内 存下,减小这个值能生成更多的线程。但是操作系统对一个进程内的线程数还是有限制的,不能无限生成,经验值在3000~5000左右。

功能开关:

参数 默认值或限制 说明
-XX:-AllowUserSignalHandlers 限于Linux和Solaris,默认不启用 允许为java进程安装信号处理器,信号处理参见类:sun.misc.Signal, sun.misc.SignalHandler
-XX:+DisableExplicitGC 默认启用 禁止在运行期显式地调用System.gc()
-XX:+FailOverToOldVerifier Java6新引入选项,默认启用 如果新的Class校验器检查失败,则使用老的校验器(失败原因:因为JDK6最高向下兼容到JDK1.2,而JDK1.2的class info 与JDK6的info存在较大的差异,所以新校验器可能会出现校验失败的情况)
-XX:+HandlePromotionFailure java5以前是默认不启用,java6默认启用 关闭新生代收集担保
-XX:+MaxFDLimit 限于Solaris,默认启用 设置java进程可用文件描述符为操作系统允许的最大值。
-XX:PreBlockSpin=10 -XX:+UseSpinning 必须先启用,对于java6来说已经默认启用了,这里默认自旋10次 控制多线程自旋锁优化的自旋次数
-XX:-RelaxAccessControlCheck 默认不启用 在Class校验器中,放松对访问控制的检查,作用与reflection里的setAccessible类似
-XX:+ScavengeBeforeFullGC 默认启用 在Full GC前触发一次Minor GC
-XX:+UseAltSigs 限于Solaris,默认启用 为了防止与其他发送信号的应用程序冲突,允许使用候补信号替代 SIGUSR1和SIGUSR2
-XX:+UseBoundThreads 限于Solaris, 默认启用 绑定所有的用户线程到内核线程, 减少线程进入饥饿状态(得不到任何cpu time)的次数
-XX:-UseConcMarkSweepGC 默认不启用 启用CMS低停顿垃圾收集器,减少FGC的暂停时间
-XX:+UseGCOverheadLimit 默认启用 限制GC的运行时间。如果GC耗时过长,就抛OOM
-XX:+UseLWPSynchronization 限于solaris,默认启用 使用轻量级进程(内核线程)替换线程同步
-XX:-UseParallelGC -server时启用,其他情况下,默认不启用 策略为新生代使用并行清除,年老代使用单线程Mark-Sweep-Compact的垃圾收集器
-XX:-UseParallelOldGC 默认不启用 策略为老年代和新生代都使用并行清除的垃圾收集器
-XX:-UseSerialGC -client时启用,其他情况下,默认不启用 使用串行垃圾收集器
-XX:-UseSpinning java1.4.2和1.5需要手动启用, java6默认已启用 启用多线程自旋锁优化
-XX:+UseTLAB 1.4.2以前和使用-client选项时,默认不启用,其余版本默认启用 启用线程本地缓存区
-XX:+UseSplitVerifier java5默认不启用, java6默认启用 使用新的Class类型校验器
-XX:+UseThreadPriorities 默认启用 使用本地线程的优先级
-XX:+UseVMInterruptibleIO 限于solaris,默认启用 在solaris中,允许运行时中断线程

性能参数:

参数 默认值或限制 说明
-XX:+AggressiveOpts JDK 5 update 6后引入,但需要手动启用, JDK6默认启用 启用JVM开发团队最新的调优成果。例如编译优化,偏向锁,并行年老代收集等
-XX:CompileThreshold=10000 1000 通过JIT编译器,将方法编译成机器码的触发阀值,可以理解为调用方法的次数,例如调1000次,将方法编译为机器码
-XX:LargePageSizeInBytes=4m 默认4m, amd64位:2m 设置堆内存的内存页大小
-XX:MaxHeapFreeRatio=70 70 GC后,如果发现空闲堆内存占到整个预估上限值的70%,则收缩预估上限值
-XX:MaxNewSize=size 1.3.1 Sparc: 32m, 1.3.1 x86: 2.5m 新生代占整个堆内存的最大值
-XX:MaxPermSize=64m 5.0以后: 64 bit VMs会增大预设值的30%, 1.4 amd64: 96m, 1.3.1 -client: 32m, 其他默认 64m Perm(俗称方法区)占整个堆内存的最大值
-XX:MinHeapFreeRatio=40 40 GC后,如果发现空闲堆内存占到整个预估上限值的40%,则增大上限值
-XX:NewRatio=2 Sparc -client: 8, x86 -server: 8, x86 -client: 12, -client: 4 (1.3), 8 (1.3.1+), x86: 12, 其他默认 2 新生代和年老代的堆内存占用比例, 例如2表示新生代占年老代的1/2,占整个堆内存的1/3
-XX:NewSize=2.125m 5.0以后: 64 bit Vms 会增大预设值的30%, x86: 1m, x86, 5.0以后: 640k, 其他默认 2.125m 新生代预估上限的默认值
-XX:ReservedCodeCacheSize=32m Solaris 64-bit, amd64, -server x86: 48m, 1.5.0_06之前, Solaris 64-bit amd64: 1024m, 其他默认 32m 设置代码缓存的最大值,编译时用
-XX:SurvivorRatio=8 Solaris amd64: 6, Sparc in 1.3.1: 25, Solaris platforms 5.0以前: 32, 其他默认 8 Eden与Survivor的占用比例。例如8表示,一个survivor区占用 1/8 的Eden内存,即1/10的新生代内存,为什么不是1/9? 因为我们的新生代有2个survivor,即S0和S1。所以survivor总共是占用新生代内存的 2/10,Eden与新生代的占比则为 8/10
-XX:TargetSurvivorRatio=50 50 实际使用的survivor空间大小占比。默认是50%,最高90%
-XX:ThreadStackSize=512 Sparc: 512, Solaris x86: 320 (5.0以前 256), Sparc 64 bit: 1024, Linux amd64: 1024 (5.0 以前 0), 其他默认 512. 线程堆栈大小
-XX:+UseBiasedLocking JDK 5 update 6后引入,但需要手动启用, JDK6默认启用 启用偏向锁
-XX:+UseFastAccessorMethods 默认启用 优化原始类型的getter方法性能(get/set:Primitive Type)
-XX:-UseISM 默认启用 启用solaris的ISM
-XX:+UseLargePages JDK 5 update 5后引入,但需要手动启用, JDK6默认启用 启用大内存分页
-XX:+UseMPSS 1.4.1 之前: 不启用, 其余版本默认启用 启用solaris的MPSS,不能与ISM同时使用
-XX:+UseStringCache 默认开启 启用缓存常用的字符串。
-XX:AllocatePrefetchLines=1 1 Number of cache lines to load after the last object allocation using prefetch instructions generated in JIT compiled code. Default values are 1 if the last allocated object was an instance and 3 if it was an array.
-XX:AllocatePrefetchStyle=1 1 Generated code style for prefetch instructions. 0 – no prefetch instructions are generated, 1 – execute prefetch instructions after each allocation, 2 – use TLAB allocation watermark pointer to gate when prefetch instructions are executed.
-XX:+UseCompressedStrings Java 6 update 21有一选项 其中,对于不需要16位字符的字符串,可以使用byte[] 而非char[]。对于许多应用,这可以节省内存,但速度较慢(5%-10%)
-XX:+OptimizeStringConcat 在Java 6更新20中引入 优化字符串连接操作在可能的情况下

调试参数:

参数 默认值或限制 说明
-XX:-CITime 打印发费在JIT编译上的时间
-XX:ErrorFile=./hs_err_pid.log JDK6中引入 错误文件
-XX:-ExtendedDTraceProbes JDK6中引入仅在Solaris 启用性能的影响DTrace探测器
-XX:HeapDumpPath=./java_pid.hprof 1.4.2 update 12, 5.0 update 7 指定HeapDump的文件路径或目录
-XX:-HeapDumpOnOutOfMemoryError 1.4.2 update 12, 5.0 update 7 当抛出OOM时进行HeapDump
-XX:OnError=”; 1.4.2 update 9 当发生错误时执行用户指定的命令
-XX:OnOutOfMemoryError=”; 1.4.2 update 12, 6 当发生OOM时执行用户指定的命令
-XX:-PrintClassHistogram 1.4.2 当Ctrl+Break发生时打印Class实例信息,与jmap -histo相同
-XX:-PrintConcurrentLocks 6 当Ctrl+Break发生时打印java.util.concurrent的锁信息, 与jstack -l相同
-XX:-PrintCommandLineFlags 5 打印命令行上的标记
-XX:-PrintCompilation 当方法被编译时打印信息
-XX:-PrintGC 当GC发生时打印信息
-XX:-PrintGCDetails 1.4.0 打印GC详细信息
-XX:-PrintGCTimeStamps 1.4.0 打印GC用时
-XX:-PrintTenuringDistribution 打印Tenuring年龄信息
-XX:-TraceClassLoading 跟踪类加载
-XX:-TraceClassLoadingPreorder 1.4.2 跟踪所有加载的引用类
-XX:-TraceClassResolution 1.4.2 跟踪常量池的变化
-XX:-TraceClassUnloading 跟踪类的卸载
-XX:-TraceLoaderConstraints 6 Trace recording of loader constraints
-XX:+PerfSaveDataToFile 退出时保存jvmstat二进制文件
-XX:ParallelGCThreads= 设置新生代与老年代并行垃圾回收器的线程数
-XX:+UseCompressedOops Enables the use of compressed pointers (object references represented as 32 bit offsets instead of 64-bit pointers) for optimized 64-bit performance with Java heap sizes less than 32gb.
-XX:+AlwaysPreTouch Pre-touch the Java heap during JVM initialization. Every page of the heap is thus demand-zeroed during initialization rather than incrementally during application execution.
-XX:AllocatePrefetchDistance= Sets the prefetch distance for object allocation. Memory about to be written with the value of new objects is prefetched into cache at this distance (in bytes) beyond the address of the last allocated object. Each Java thread has its own allocation point. The default value varies with the platform on which the JVM is running.
-XX:InlineSmallCode= 当编译的代码小于指定的值时,内联编译的代码
-XX:MaxInlineSize=35 内联方法的最大字节数
-XX:FreqInlineSize= 内联频繁执行的方法的最大字节码大小
-XX:LoopUnrollLimit= Unroll loop bodies with server compiler intermediate representation node count less than this value. The limit used by the server compiler is a function of this value, not the actual value. The default value varies with the platform on which the JVM is running.
-XX:InitialTenuringThreshold=7 设置初始的对象在新生代中最大存活次数
-XX:MaxTenuringThreshold= 设置对象在新生代中最大的存活次数,最大值15,并行回收机制默认为15,CMS默认为4

Garbage Collectors

The JVM (Java Virtual Machine) has several different garbage collectors, including the Parallel Scavenge collector and the G1 (Garbage-First) collector. Both collectors have a “young generation” that is responsible for storing newly created objects, but they work in different ways.

  • Parallel Scavenge collector

The Parallel Scavenge collector’s young generation, also known as the “PS young generation”, is divided into two regions called “Eden” and “Survivor”. The Eden region is where newly created objects are initially allocated, while the Survivor regions are used to store objects that have survived one or more garbage collection cycles. The idea is to quickly identify and collect objects that are no longer needed, while promoting long-lived objects to the older generation.

  • G1 collector

The G1 collector also has a young generation, which is referred to as the “G1 young generation”. Unlike the PS young generation, the G1 young generation does not have fixed regions like Eden and Survivor. Instead, the G1 collector divides the heap into equal-sized “regions” that can be used for both young and old objects, depending on their age and usage patterns. The G1 collector also uses a “remembered set” to keep track of references between regions, which allows it to more efficiently identify and collect objects that are no longer needed.

Overall, both the PS and G1 collectors have their own strengths and weaknesses, and the best choice depends on the specific requirements and characteristics of the application. The G1 collector is generally considered to be more flexible and adaptive to different usage patterns, but the PS collector may be better suited for applications with short-lived objects and high object creation rates.

金钱换不来的东西才算珍贵,比如时间、健康、知识

✔️

身体是本钱

英语是编程语言的基础语言

    April   2021
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 ✔️ 17
18 19 20 21 22 23 24
25 26 27 28 29 30
     June   2021          
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29✔️ 30✔️
     July   2021          
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

2021年07月01日

测试链接
后面可以修改连接处标题由71改为2021年07月01日

2021-04-14

今天记录了一个ignite问题,并更新于post,提交到github,打开github发现2020年只有四个绿点。
2021年以后的时间,争取一个周可以有一个绿点吧

2021-04-16

  • 行动为王,思想为妃

  • 自律且专注

知识的成长周期,只有输入,没有输出,那么输入就失去了意义,输入的东西生命也不会长久,并且浪费了之前付出的时间。
输出,不限于做一件事情,解决一个问题,还可能只是一行文字,一点领悟。

参数配置

  • tickTime

Length of a single tick, in milliseconds. ZooKeeper uses tick as the basic time unit to regulate timeouts. Default is 2000.

  • initLimit

Number of ticks after which the ZooKeeper server times out during the synchronization process. Default is 10.

  • syncLimit

Maximum number of ticks for the followers to wait to synchronize with the leader before the followers time out. Default is 5.

  • dataDir

Absolute path for the ZooKeeper to store the in-memory snapshots of the data and the transactional log of updates to the database.

  • clientPort

Port on which the ZooKeeper server listens for client connections.

  • maxClientCnxns

Maximum number of concurrent connections that a single client can make to a single member of the ZooKeeper ensemble. Default is 10.

终端操作

登录

1
zkCli.sh -server 127.0.0.1:2181

新増节点

1
create [-s] [-e] path data #其中-s 为有序节点,-e临时节点。不写 -s/-e 默认为创建持久化节点

查看节点

1
get path

  • 查看节点状态
    1
    stat path  #返回结果和get命令类似,但不会返回节点数据内容。

修改节点

1
set path data [dataVersion]

可以用set命令修改节点数据。也可以基于版本号进行修改,当传入的dataVersion与当前版本号不一致时,zookeeper会拒绝修改。

返回节点列表

1
2
ls   path
ls2 path

删除节点

1
delete path [dataVersion]

 与更新节点类似,删除也可以传入版本号,当传入的dataVersion与当前版本号不一致时,zookeeper会拒绝删除。

  • 要想删除某个节点及其后代节点,可以使用递归删除
    1
    rmr path

运行时框架

作业调度框架

table模块架构

进程

TaskExecutor

  1. taskmanager.numberOfTaskSlots:指定每个TaskExecutor的任务槽数量。默认情况下,该属性设置为1,表示每个TaskExecutor只能执行一个任务。如果需要在同一节点上并行执行多个任务,则需要将该属性设置为大于1的值。
  2. taskmanager.memory.process.size:指定TaskExecutor进程的内存大小。默认情况下,该属性设置为1GB。可以根据节点的资源情况和作业的内存需求进行适当调整。
  3. taskmanager.cpu.cores:指定TaskExecutor可以使用的CPU核心数量。默认情况下,该属性设置为所有可用的CPU核心数。可以根据节点的CPU资源情况和作业的CPU需求进行适当调整。
  4. taskmanager.tmp.dirs:指定TaskExecutor使用的临时文件目录。默认情况下,该属性设置为系统的临时目录。可以根据节点的磁盘空间情况和作业的磁盘需求进行适当调整。