Dev's Logging

Welcome to my blog !


HTTP API 认证授权术 | | 酷 壳 - CoolShell

Published at May 10, 2019 ·  1 min read

详细完整的 http API 认证授权的介绍,因为 http 是无状态,则需要客户端与服务端配合完整用户的认证与授权工作,常见的非别有 http basic, digest access, app secrete key + hmac, jwt json web tokens, oauth 1.0, oauth 2.0 HTTP API 认证授权术 | | 酷 壳 - CoolShell...

Difference Between BFS and DFS (with Comparison Chart) - Tech Differences

Published at May 5, 2019 ·  1 min read

dfs 和 bfs 的区别,两者复杂度较为接近,而需要的存储则大不相同。bfs 采用 queue 存储访问过的节点,适合于 wide and short tree。 dfs 则需要 stack 存储访问过的节点,或者递归的方式访问,存储较为高效。 Difference Between BFS and DFS (with Comparison Chart) - Tech Differences...

MySQL 索引设计概要

Published at April 30, 2019 ·  1 min read

如何正确高效的设计索引,由于 hdd 的特性,随即访问数据是非常耗时的,对于数据库,无论是读取一行还是多行数据,都会将该行或多行所在的页面全部加载进来,然后再读取对应的数据记录。在 mysql 中,页的大小一般为 16 kb,也可能是 8kb,32 kb 或者其他值。数据库等待一个页从磁盘读取到缓存池所需要的成本巨大,需要消耗 10ms 左右的时间,如果顺序读取则会非常快,达到 40MB/s。如果一个页面的大小为 4kb,那么 1s 的时间就可以读取 10000 个页,读取一个页面所花费的平均时间就是 0.1 ms,相比随即读取的 10ms 已经降低了两个数量级,甚至比内存中读取数据还要快。数据库索引设计与优化中,分为宽索引与窄索引,每一个在索引中匹配到的记录行最终都需要执行另外的随即读取从聚集索引中获得剩余的数据,如果结果集非常大,那么就会导致随机读取的次数过多进而影响性能。 MySQL 索引设计概要...

为什么使用 B-Tree(B+Tree)

Published at April 29, 2019 ·  1 min read

由于机械磁盘的特性,磁盘的存取速度比主存慢很多,往往是其的 几百分分之一,因此为了提高效率及减少磁盘 I/O,往往每次读取都会预读,即使读取一个字节,也需要从此往后读取一定长度的数据放入内存,预读的长度一般为页(page)的整数倍。而 B Tree 之所以高效,根据 B-Tree 的定义,可知检索一次最多需要访问 h 个节点,一次检索最多需要 h-1 次 I/O,渐进复杂度为 O(h) = O(logdN)。一般实际应用中,出度 d 是非常大的数字,通常超过 100, 因此 h 非常小(通常不超过3),所以 B-Tree 作为索引结构效率非常高 为什么使用 B-Tree(B+Tree)...

mysql中innodb和myisam对比及索引原理区别-云栖社区-阿里云

Published at April 29, 2019 ·  1 min read

如何选择 mysql 中的索引。 innoDB 支持事物和外键,支持 4 个事务隔离级别,回滚,崩溃修复能力和多版本并发的事务安全,包括 ACID,如果应用中需要执行大量的 insert 或 update 操作,则应该使用 InnoDB,这样可以提高多用户并发操作的性能,MyISAM 管理非事务表,提供高速存储和检索,以及全文搜索能力。如果应用中需要大量的 select 查询,则选择 MyISAM。InnoDB 使用的聚簇索引、索引就是数据,顺序存储,因此能缓存索引,也能缓存数据。MyISAM 堆组织表 使用的是非聚簇索引、索引和文件分开,随即存储,只能缓存索引。MyISAM 读写互相阻塞:不仅会在写入的时候阻塞读取,MyISAM 还会在读取的时候阻塞写入,但读本身并不会阻塞另外的读。InnoDB 读写阻塞与事务隔离级别相关。 mysql中innodb和myisam对比及索引原理区别-云栖社区-阿里云...

What Is Layer 4 Load Balancing? | NGINX Load Balancer

Published at April 26, 2019 ·  1 min read

layer 4 和 layer 7 负载均衡的比较。 layer 4 主要是在 tcp/ip 层根据请求 ip 等进行请求的负载均衡, 而 layer 7 则是在 http 层,偏向应用层,可以通过 http header 等信息进行负载均衡,当然性能相比于 layer 4 会低些,资源消耗也会更多。其中 nginx 和 haproxy 两种模式均有,traefik 则只有 layer 7 一种模式 What Is Layer 4 Load Balancing? | NGINX Load Balancer...

Build Your Own Container Using Less than 100 Lines of Go

Published at April 20, 2019 ·  1 min read

用 Golang 从零搭建 Docker,关键概念分别是,Namespaces,将 container 与 host 的环境相互隔离,cgroups 管理 container 中的资源使用,Layered filesystem 是 docker 打包镜像时的管理技术,将镜像分层方便镜像的管理和复用 Build Your Own Container Using Less than 100 Lines of Go...

What are some (concrete) use-cases for metaclasses?

Published at April 17, 2019 ·  1 min read

非常详细和完整的举例说明 metaclass 的用例。当需要重构,更改新增某些 class 属性时,另外一个则是注册,获取继承 metaclass 的 class 。 What are some (concrete) use-cases for metaclasses?...

Tags

abcs accept acid activemq affinity algorithm allocation android array async aws b+tree b-tree backoff benchmark best-practices bfs big-o bigquery bind bitcount blog break broker bubble buffer cache cap cert cgroups channel citus class classmethod closure closures cluster concurrency config consistency consumer container context cookie cors crawler cronjob csrf ctr data-science data-structure database datadog dataflow datascience decorator deepcopy defer dfs distributed django dns docker double-shipping drf ecosia elastic-search enumerate epoll equal errgroup escaping event extra fabric2 facebook-pixel financial-report flask flutter forward-proxy freelance frontend frp garbage-collector gc gcp generator gesture get gil git golang goroutine graphql ha handbook haproxy hash hash-slot hashring hashtable hpa http http-auth http-proxy http_proxy https index init innodb instagram intention-lock intergration interview ios is javascript jinja2 jobboard json jwt k8s kafka kibana kqueue label lambda layer4 layer7 lean levels.io linked-list linux list listen loadbalancer lock logs long-tail lru marketing master matplotlib memory merge metaclass metaprogramming metrics metrics-server microservices mitm mobile model mongo mongoose mq myisam mysql namespace nat netflix network network-extension nginx nodejs nomad nosql notification npm oodesign openssl optimization orm osi pandas parallelism paramiko parkinglot patroni permission pg pipeline pixelme post postgresql postresql prefetch_related prerender private-key process proxy proxycommand put pvm python queue rabbitmq rbac react-native reactive reactjs rebase redis redis-cluster replication resource rest restfulapi retargeting retry revenue reverse-proxy rocketmq rsa rxswift saas scaffold scaleable search-engine security select seo serverless service session set shadosocks shadowsocks shard sharding shell shopify sigint signal sigterm singleton slack slave slow-query sniper sns socket socks5 source-code spa sql sqlalchemy sqs ssh ssl ssl-pinning stack startup state stateful stateless staticmethod string struct swift swiftui switch syscall system-design systemctl tcp tcp-proxy thread tmpreaper token traefik trustkit tunning type typeform udp userdefaults variable vc voidcallback vpn vuejs weak web web-development where widget with yarn zset 削峰 单例模式 宽索引 异步 看源码学-golang 窄索引 解耦 跨域 跳板机


Archives

2020 (6)
2019 (157)
0001 (5)