828 Matching Annotations
  1. Oct 2020
    1. Under the Hood article: "The lean, mean virtual machine."
    2. two opcodes directly related to thread synchronization, the opcodes used for entering and exiting monitors.

      two opcodes entering & exiting monitors

      so what is monitor ?

    1. Quota Scopes

      三种 scope,主要是针对 Pod 的不同状态的

      • Terminating
      • NotTerminating
      • BestEffort
      • NotBestEffor
    2. local ephemeral storage

      非 memory 的 local ephemeral storage 也需要实体硬盘来支撑吧

    1. A context is a combination of several properties. These include
      • name
      • endpoint config
      • TLS info
      • Orchestrator
    1. buildx 最详细的文档了。。。

    2. docker

      没太看懂和 image 的区别

    3. via https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources

      This feature requires the BuildKit backend. You can either enable BuildKit or use the buildx plugin. The previous builder has limited support for reusing cache from pre-pulled images.

    4. mode - Specifies how many layers are exported with the cache.

      mode:

      • “min” on only exports layers already in the final build build stage.
      • “max” exports layers for all stages.

      Metadata is always exported for the whole build.

    5. Supported types are registry, local and inline
      • registry exports build cache to a cache manifest in the registry,
      • local exports cache to a local directory on the client
      • inline writes the cache metadata into the image configuration.
    1. The OCI format is a specification for container images based on the Docker Image Manifest Version 2, Schema 2 format.

      OCI: Open Container Initiative

    1. You can run Buildx in different configurations that are exposed through a driver concept. Currently, Docker supports a “docker” driver that uses the BuildKit library bundled into the docker daemon binary, and a “docker-container” driver that automatically launches BuildKit inside a Docker container.

      一个聊胜于无的关于 docker builder driver 的解释

    1. nice walk through of how to use command: helm

    1. via ruanyifeng http://www.ruanyifeng.com/blog/2020/09/weekly-issue-127.html

      漫画家斯科特·亚当斯(Scott Adams)曾经提过一种建立个人护城河的方法,就是找到自己最擅长的2个~3个事物的交集。比如,他既不是最好的漫画家,也不是最好的作家,也不是最好的企业家,但他可以是最好的商业类漫画短文作者,这就是他的护城河。

    1. Java 内存模型是个很复杂的规范,可以从不同的视角来解读,站在我们这些程序员的视角,本质上可以理解为,Java 内存模型规范了 JVM 如何提供按需禁用缓存和编译优化的方法。具体来说,这些方法包括 volatile、synchronized 和 final 三个关键字,以及六项 Happens-Before 规则,这也正是本期的重点内容。

      这个解读有点儿意思

    1. If an environment variable is only needed during build, and not in the final image, consider setting a value for a single command instead:

      ENV 会在 container 中也生效,如果没有这个需求,而只是希望在 build 阶段用到变量,应该使用 ARG

    2. The ARG instruction defines a variable that users can pass at build-time to the builder with the docker build command using the --build-arg <varname>=<value> flag

      build image 的入参

    1. nice saas tool for generating pics for/from sns

    1. replicated three ways

      3 ways 啥意思?

    2. “Ongoing,” “Prepare commit,” and “Completed.”

      Transaction states:

      • ongoing
      • prepare commit
      • commited
    3. watch the Kafka summit talk where transactions were introduced.
  2. Aug 2020
    1. The PUT and POST verbs on objects MUST ignore the "status" values, to avoid accidentally overwriting the status in read-modify-write scenarios. A /status subresource MUST be provided to enable system components to update statuses of resources they manage.

      status 需要单独的接口更新


      <del>?</del>

    1. When a TCP packet carrying some of those bytes is lost on the network path, it creates a gap in the stream and TCP needs to fill it by resending the affected packet when the loss is detected. While doing so, none of the successfully delivered bytes that follow the lost ones can be delivered to the application, even if they were not themselves lost and belong to a completely independent HTTP request. So they end up getting unnecessarily delayed as TCP cannot know whether the application would be able to process them without the missing bits. This problem is known as “head-of-line blocking”.

      head-of-line blocking

  3. Jul 2020
    1. QUIC 功能
      • ZERO-RTT 如何实现的?
      • TCP 如何重传?
      • TCP 基于 IP&PORT, UDP呢?
      • 加密?how?
    2. HTTP/2 特性
      • 二进制
      • 多路复用
      • header 压缩
      • server push
    1. nice article explaining HTTP/1.1 keep-alive

      a runnable demo worth thousand words

    2. We can actually check this difference using telnet.

      really cool

      HTTP/1.0

      ➜  telnet -4 taobao.com 80
      Trying 140.205.94.189...
      Connected to taobao.com.
      Escape character is '^]'.
      
      HEAD / HTTP/1.0
      host: taobao.com
      
      HTTP/1.1 302 Found
      Server: Tengine
      Date: Fri, 31 Jul 2020 03:21:12 GMT
      Content-Type: text/html
      Content-Length: 258
      Connection: close <<<<<<<<<<<<<<<<<<<<<<<
      Location: http://www.taobao.com/
      

      HTTP/1.1

      ➜  telnet -4 taobao.com 80
      Trying 140.205.220.96...
      Connected to taobao.com.
      Escape character is '^]'.
      
      HEAD / HTTP/1.1
      host: taobao.com
      
      HTTP/1.1 302 Found
      Server: Tengine
      Date: Fri, 31 Jul 2020 03:20:53 GMT
      Content-Type: text/html
      Content-Length: 258
      Connection: keep-alive <<<<<<<<<<<<<<<<<<<<<<<
      Location: http://www.taobao.com/
      
    1. keep in mind that no built-in controllers are running in the test context

      no build-in controllers are running

    1. The object is still visible via the REST API

      still visible for objects in deletion

    1. When a Certificate is created, a corresponding CertificateRequest resource is created by cert-manager containing the encoded x509 certificate request, Issuer reference, and other options based upon the specification of the Certificate resource.

      这里 Certificate 更像是一种声明或者说意图,需要 Issuer 的进一步处理,才能得到我们想象中的 certificate key pair

      CertificateRequest is created by cert-manager containing:

      • encoded x509 certificate request
      • issuer ref
      • other options
    1. generated labels
      {
          app_name="ddex-api"
          instance="100.96.17.155:9091"
          job="ddex-metrics"
          key="v3/POST-buildOrder"
          le="10"
          namespace="production"
          node_name="nodes-c507"
          pod_name="ddex-api-5cb9b89f58-7fnbc"
          ready="true"
      }   0
      
    2. an endpoint you can scrape is called an instance, usually corresponding to a single process. A collection of instances with the same purpose, a process replicated for scalability or reliability for example, is called a job.

      怪异的名字

      • instance: 被扒的那个进程
      • job: 同性质的 instance 的集合

      比如 api 服务,在k8s 中以 deployment 部署,scale 为 5。

      则 api-1... api-5 是一个个的 instance,而这五个pod,是一个job

  4. Jun 2020
    1. 这篇好啊,特别是这张对应代码的图,对Heap & Stack 的作用展示的很清晰

    1. via limin

      also heavily mentioned in book: k8s operator


      alternative for kubebuilder? this one get more starts

  5. May 2020
    1. As circuit breaking applies to “real” mesh destinations in a load balancing pool, you configure circuit breaker thresholds in destination rules, with the settings applying to each individual host in the service.

      还是没懂这个怎么就放在 DestinationRules 上了,前面都是配置在 VirtualService

      另外这个 circuit breaker 的规则是在每一个 host 上生效,如果一个服务有多个 pods,会每个 pod 去连一遍么,还是单个失败了,就直接短路

    2. Istio failure recovery features are completely transparent to the application

      ? 怎么个透明法?

    3. You don’t need to add a service entry for every external service that you want your mesh services to use. By default, Istio configures the Envoy proxies to passthrough requests to unknown services.

      未知的服务 Envoy 会放行,所以并不需要每个外部服务都做配置?

    1. MARK

    2. Exercise: Loop over the string using the %q format on each byte. What does the output tell you?]

      ?

      '½''²''=''¼'' ''â''\u008c''\u0098'
      
    1. Some resources in the v1 API contain fields called phase, and associated message, reason, and other status fields. The pattern of using phase is deprecated

      phase is deprecated, use conditions instead...

    2. Conditions represent the latest available observations of an object's state.

      status.conditions

    3. PUT expects the whole object to be specified. Therefore, if a field is omitted it is assumed that the client wants to clear that field's value. The PUT verb does not accept partial updates.

      PUT 是覆盖式的

    1. For example a client may acquire the lock, get blocked in some operation for longer than the lock validity time (the time at which the key will expire), and later remove the lock, that was already acquired by some other client.

      即使加上后面的乐观锁检查,

      这种设计下,还是有corner case:

      当 原先持有锁的 A因为某些原因暂停了一段时间,导致自己失去了锁,等它醒来之后锁已经被 B 获取,而 A 还以为自己有锁,这时会出现一个短暂的时间段,A 和 B 都认为自己有锁,BOOM!


      反驳的文章也提到了这一点,解决的办法是使用乐观锁,例如数据库里记录增加 version 字段

      https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html#making-the-lock-safe-with-fencing

      不过这时候,例如数据库有乐观锁的支持,那也不需要靠redis 来提供分布式锁的支持了。

    2. split brain conditions

      ?

    1. a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree generalizes the binary search tree, allowing for nodes with more than two children.

      key word:

      • self-balancing
      • generalize BST by allowing more than 2 children
    1. InnoDB 中用于存储数据的文件总共有两个部分,一是系统表空间文件

      二呢?。。。

    2. 默认情况下,表空间中的页大小都为 16KB

      一个 page 挺小的啊,16k,只能存几行记录

    1. To control the cascading deletion policy, set the propagationPolicy field on the deleteOptions argument when deleting an Object. Possible values include “Orphan”, “Foreground”, or “Background”.

      删除 owner 时,可以指定级联删除的策略,包括:

      • Orphan - 不删除 dependents
      • Foreground - 先删除 dependents, 完事儿后再删除 owner
      • background - 先删除 owner,之后处理 dependents
    1. Indexer: An indexer provides indexing functionality over objects.

      还是不太懂这个 Indexer 是干啥的,哪儿能用到

    1. 192.77 Sai / ETH 的价格

      3456.79 个 Sai 换成了 17.9 个 ETH


      0xb4 的地址剩余 10Sai ,看看 Sai 关停后处理流程是啥

    1. 文章不错不过对面试帮助不大,因为面试要涉及的几个概念,文章都没太讲到:

      • mark-sweep
      • tri-color
      • write barrier
    2. While the Marking work is happening on P1, application work can continue concurrently on P2, P3 and P4.

      GC runs with user app

    3. The only way to do that is for the collector to watch and wait for each goroutine to make a function call.

      make a function call?

    1. expose the service using an Ingress resource that will be handled by istio-ingressgateway.

      感觉这个 Ingress 没啥作用,和 Istio 的 Gateway 有重复

    2. Istio as a secure Kubernetes Ingress controller

      Istio now is the controller of our k8s Ingress

    1. using the given private key

      ?

      CA 是自己又一个私钥,用来签其他的证书,而 selfsigned 就是自己提供私钥自己签。

    2. SelfSigned

      没懂这个是用来干啥的

    1. The relevant extension for Extended Validation (EV) is Certificate Policies. Certificate sellers will refuse to issue wildcard certificates with EV, because cabforum.org, the regulatory body governing the issuance of EV SSL Certificates decided this is a big no no. EV certificates can, however, have as much SubjectAltName as you wish.

      ? 在说啥。。。

    2. C=PT, ST=Lisboa, L=Lisboa, O=Example Org, CN=*.example.org

      entity

    3. C=PT, ST=Lisboa, L=Lisboa, O=Sz CA, OU=SZ CA

      Issuer

  6. cert-manager.io cert-manager.io
    1. Take note of the index keys used for each field as these are required in order for cert-manager to find the certificate and key.

      这儿意思是说 secret 的 fields 是固定的,必须是:

      • tls.crt
      • tls.key

      ?

    1. acme-crt-secret

      refed issuer will try to obtain a certificate key pair for domains, and stored in this secret: acme-crt-sercret, with keys of:

      • tls.key
      • tls.crt
    1. Unlike the previous sections, the Istio default ingress gateway will not work out of the box because it is only preconfigured to support one secure host

      只支持一个 TLS 域名的时候不需要修改 istio-ingressgateway 是因为它做了预配置以支持一个 TLS Host

    2. Redeploy istio-ingressgateway with the new certificate

      Gateway 支持多个证书时,File Mount 的方法需要重新部署 istio-ingressgateway ,这是它的最大缺点

      重新部署是因为需要把新证书 mount 到 istio-ingressgateway 的文件系统

    1. Design goals

      design goals 里,这两点明白意思

      • 第一点: 对开发者尽量透明
      • 第三点:尽量多平台都可用(感觉没意义,除了k8s,提到的几个其他平台真的有人用?)

      剩下的:

      • 第二点:Extensibility
      • 第四点:Policy Uniformity

      不懂在说啥。。。

    2. Traffic in Istio is categorized as data plane traffic and control plane traffic.

      traffic in Istio:

      • data plane traffic: biz logic traffic
      • control plane traffic: config & control msg between Istio components
    1. Great article on Demystifying Istio's Sidecar istio-proxy

    2. We did briefly mention that it is done by setting up the iptable rules within the pod namespace, which in turn is done by the istio-init container.

      粗略的说,通过修改 pod 的 iptable rules 来使 sidecar proxy 完成进出流量的截取,而 iptables 的修改是通过 init-container 来完成的。

      那更进一步的细节呢?见下文

    3. An admission controller is a piece of code that intercepts requests to the Kubernetes API server prior to persistence of the object, but after the request is authenticated and authorized.

      admission controller 会拦截发往 k8s API Server 的请求,拦截的时机在

      • 请求被 auth & authz 之后
      • 持久化 k8s 对象之前
    4. two types of admission webhooks, validating admission Webhook and mutating admission webhook

      2 types of admission webhooks:

      • validating admission webhook
      • mutating admission webhook
    1. The static_resources block contains definitions for clusters and listeners that aren’t dynamically managed. A cluster is a named group of hosts/ports, over which Envoy will load balance traffic, and listeners are named network locations that clients can connect to.
      static_resources:
          listerners: []  #  A cluster is a named group of hosts/ports, over which Envoy will load balance traffic
          clusters:[]  # listeners are named network locations that clients can connect to
      
    1. In other words, the Gateway resource must reside in the same namespace as the gateway workload instance.

      Gateway 必须和 Istio 的 proxy 配置在同一个 namespace 中?也就是 Gateway 必须配置在 istio-system 中?

      貌似并不是这样

    2. One or more labels that indicate a specific set of pods/VMs on which this gateway configuration should be applied.

      Istio 的 Gateway 和 k8s 原生的 Ingress 一样,其实都是一种对真正的 Proxy 的配置

      • k8s 里 Ingress 可以配置 Nginx / kong
      • istio 里 Gateway 配置 istio 自己实现的 代理
    3. While Istio will configure the proxy to listen on these ports, it is the responsibility of the user to ensure that external traffic to these ports are allowed into the mesh.

      ?

    4. The gateway will be applied to the proxy running on a pod with labels app: my-gateway-controller.

      Gateway

      spec.selector

    1. Share u with the json.Unmarshal function.

      &u, address of pointer u?

    2. Here is an example of a stack that is replaced several times because of growth.

      没太看懂

    3. Escape analysis is the process that the compiler uses to determine the placement of values that are created by your program.

      Escape Analysis: 编译器用来决定内存的分配位置,stack or heap

    1. Pointer variables are not special because they are variables like any other variable. They have a memory allocation and they hold a value.

      指针变量并不特殊,也需要对应的分配内存,有对应的值

    2. This is what the stack looks like after the function call to increment:

      这个图还蛮好的,帮助理解 stack、值、值的指针

      pointer 让跨 栈帧 的内存共享成为可能

      传递的是 Pointer, &count

    3. Variables serve the purpose of assigning a name to a specific memory location for better code readability

      变量是内存地址的一个代号,方便代码的阅读

    1. 基本了解了 逃逸分析 是干什么的:编译器通过确定变量是分配在 heap 还是 stack 上。

      不过行文感觉比较随意

    1. Since a thread cannot both be executing code and be blocked on a syscall

      why not

      意思是说一个线程在因为 系统调用被block之后,不能去执行其他代码?

  7. Apr 2020
    1. https://weibo.cn/comment/IFCnq887F?uid=1088413295&rl=0&gid=10001#cmtfrm

      在不获取手机麦克风权限的情况下,通过陀螺仪传感器数据的神经网络算法,就可以从声波振动中提取出讲话者的语音。

    1. 采用DH算法后,Premaster secret不需要传递,双方只要交换各自的参数,就可以算出这个随机数。

      不明觉厉

    1. Mapping a single virtual service to multiple “real” services is particularly useful in facilitating turning a monolithic application into a composite service built out of distinct microservices without requiring the consumers of the service to adapt to the transition.

      把一个 胖服务逐渐分拆?

    2. By contrast, container orchestration platforms like Kubernetes only support traffic distribution based on instance scaling, which quickly becomes complex.

      instance scaling 指的什么?pod 的伸缩?

    3. it’s far from all that Istio can do
      1. A/B testing
      2. new load balancing policy
      3. ...
    1. while replace directives in modules other than the main module are ignored when building the main module.

      这个怎么理解?

  8. Mar 2020
    1. You'll often hear experienced Go programmers talk about the "slice header" because that really is what's stored in a slice variable.

      sliceHeader

    1. Metric types

      4 metric types:

      • counter, keep increasing
      • gauge, can up & down
      • histogram,
      • summary ?
    1. Samples

      一个 sample 就是一个数据点,包括:

      • 对应的时间

      一条 time serial 由多个 samples 组成

  9. Feb 2020
    1. Authentication strategies

      strategies:

      • x509 client certs
      • static token file
      • bootstrap tokens
      • static password file
      • service account tokens
      • OpenID Connect Tokens
      • Webhook Token Authentication
      • Authenticating Proxy
    1. Requeue when we either see a running job (done automatically) or it’s time for the next scheduled run.

      没太懂这个 Requeue 是怎么工作的

    2. Reconcile

      when this will be called?

    3. 重点

    1. don’t need to try again

      don't need to reconcile this cronjob object again?

    2. A reconciler takes the name of an object, and returns whether or not we need to try again

      try again what?

    1. except to mark that we want a status subresource, so that we behave like built-in kubernetes types

      what subresource?

    1. That little +kubebuilder:object:root comment is called a marker. We’ll see more of them in a bit, but know that they act as extra metadata, telling controller-tools (our code and YAML generator) extra information. This particular one tells the object generator that this type represents a Kind. Then, the object generator generates an implementation of the runtime.Object interface for us, which is the standard interface that all types representing Kinds must implement.

      about the mysterious marker:

      +kubebuilder:object:root

    1. A resource is simply a use of a Kind in the API.

      多数时候,Kind 和 resource 是一对一的,例如:

      pods resource 和 Pod Kind

      但有时候,一个 Kind 对应多个 resources,例如:

      Scale Kind 对应多个 scale subresources:deployments/scale and replicasets/scale

  10. Jan 2020
    1. extension points

      so what is Extension Points...

    2. Kubernetes is designed to be automated by writing client programs

      ? 怎么就 automated 了?

    1. Virtual IPs and service proxies

      不懂下面几小节和 Virtual IPs and service proxies 的关系

      • User space proxy mode
      • iptables proxy mode
      • IPVS proxy mode

      可能是说 kueb-proxy 使用这几种模式来支持 Service

    2. ServiceTypes

      4:

      1. ClusterIP
      2. NodePort
      3. LoadBalancer
      4. ExternalName
    3. A cluster-aware DNS server, such as CoreDNS, watches the Kubernetes API for new Services and creates a set of DNS records for each one.

      一些 cluster-ware 的 DNS 服务,例如 CoreDNS,会通过 k8s API 来监视 Service 的变动,并对应的生成 DNS 记录

    4. Kubernetes supports 2 primary modes of finding a Service - environment variables and DNS.

      2 primary modes of finding a Service:

      • ENV variables
      • DNS
    5. User space proxy mode

      ... 都是高科技。。

    1. 介个实例教程还挺好,总算大致了解 Stateful Set 的 特点/存在理由 了

    2. Pod initialization

      我自己看见的几个值得注意的点:

      1. init-container 里,根据 pod name 中的序号,对 xx-0 使用 master 配置,其他的使用 slave 配置
      2. initContainers 里 clone-mysql 干啥的没搞懂
      3. containers 里的第一个 pod:mysql 比较普通
      4. 第二个 xtrabackup, 不知道干啥的

      2: 检查如果是 slave pod 第一次启动,则从前一个 pod 同步数据,已加速之后和 master 的同步

    1. MVCC

      Multi-Version Concurrency Control: MVCC

    2. 在可重复读中,该sql第一次读取到数据后,就将这些数据加锁,其它事务无法修改这些数据,就可以实现可重复读了

      和上面例子有冲突

      B 确实修改了 A 读出来的数据,并没有被锁挡住

      why?

    3. 事务B也就一直拿不到该行锁,wait直到超时。

      如果这儿 B 事务是读呢?

      是怎么保证 B 不会读到尚未提交的修改的?

    1. Because slices are multiword structures, not pointers, the slicing operation does not need to allocate memory, not even for the slice header, which can usually be kept on the stack

      ?

      stack 不算 memory?

  11. Dec 2019
    1. 按照我个人的理解,在事务处理的ACID属性中,一致性是最基本的属性,其它的三个属性都为了保证一致性而存在的。

      原子性和隔离是为了保证一致性

    1. 隔离级别的实现
      • 时间戳
      • 多版本 & 快照隔离 (?)
    2. ACID
      • A - Atomicity - 原子性
      • C - Consistency - 一致性, 数据库的约束在事务执行前后都得以保全
      • I - Isolation - 隔离性 - 多个事务并发的情况下,各个事务之间如果访问资源有交叉,这些交叉资源之间相互影响的一个保证(隔离的程度)
      • D - durability - 持久性 - 除了显而易见的指数据在磁盘上的保存,还指事务提交之后,即使未写入数据库(例如因为断电),也能保证重启后数据能够提交(通过 redo log)
    3. 例如 PostgreSQL 会为每一条记录保留两个字段;读时间戳中包括了所有访问该记录的事务中的最大时间戳,而记录行的写时间戳中保存了将记录改到当前值的事务的时间戳。

      看起来 PG 和 MySQL 这儿是个很大的不同点呀

    4. Next-Key 这一块儿没讲清楚

    5. InnoDB 不仅会在范围 (21, 30] 上加 Next-Key 锁,还会在这条记录后面的范围 (30, 40] 加间隙锁

      所以这儿的 (21, 30] 的 Next-Key 锁和 (30,40] 的间隙锁,有什么区别?

    6. 意向锁其实不会阻塞全表扫描之外的任何请求,它们的主要目的是为了表示是否有人请求锁定表中的某一行数据

    7. 不可重复读的原因就是,在 READ COMMITED 的隔离级别下,存储引擎不会在查询记录时添加行锁,锁定 id = 3 这条记录。

      🔒,行锁

    8. 第 4、5 步就是在事务提交时执行的

      如果事务提交后,

      • 如果第五步出错,可以通过 redo 第四步的 redo log 来恢复
      • 但是如果第四步出现错误,会怎么办?
    9. 重做日志由两部分组成,一是内存中的重做日志缓冲区,因为重做日志缓冲区在内存中,所以它是易失的,另一个就是在磁盘上的重做日志文件,它是持久的。

      redo log:

      • in memory
      • on disk
    10. 重做日志(redo log)

      前面保证事务的是 undo log

      这儿保证持久性的是 redo log

    11. 一旦事务被提交,那么数据一定会被写入到数据库中并持久存储起来

      反过来也是在说 事务提交 和 数据被写入数据库(或者说写到磁盘) 不是同一件事