Many Links 0515

1.
CTR预估中的贝叶斯平滑方法(一)
学习了:

广告形式:互联网广告可以分为以下三种:
1)展示广告(display ad)
2)搜索广告(sponsored search ad)
3)上下文广告(contextual ad)
竞价模式:对于在线广告,主要有以下几种竞价模式:
1)pay-per-impression(按展示付费):广告商按照广告被展示的次数付费,这是一种最普遍的竞价模型。缺点在于没有考虑投放广告的效果。
2)pay-per-action(按行为付费):只有在广告产生了销售或者类似的一些转化时,广告商才付费。缺点在于追踪用户的交易行为相对比较困难。
3)pay-per-click(按用户点击付费):根据用户是否会点击广告来付费。这时候就需要对广告的点击率(CTR)进行精确的预估。
遇到的困难:
由于数据的稀疏性,对广告进行CTR预估是比较具有挑战性的,预估出来的CTR的可靠性不高,且具有较大的方差。主要有以下两类场景:
1)当广告的展示次数较少的时候,对其直接进行CTR的统计计算会导致一个偏高的结果。比如某个广告只展示了1次,被点击了1次,则纯粹的统计CTR=1.0,这显然是过分高估了。
2)当广告的展示次数很大,但点击次数很少或几乎没有的时候,对其直接进行CTR的统计计算会导致一个偏低的结果。比如某个广告没有被点击过,则纯粹的统计CTR=0.0,这显然是过分低估了。



2.
What we talk about when we talk about monads
作者Tomas Petricek,看似简介monad,但感觉是在探讨一种理解编程语言的思维/框架。
有时间可以用这篇短文打发一下:

More generally, we present a framework for understanding programming concepts that considers them at three levels: formal, metaphorical and implementation. We base such observations on established results about the scientific method and mathematical entities – cognitive sciences suggest that the metaphors used when thinking about monads are more important than widely accepted, while philosophy of science explains how the research paradigm from which monads originate influences and restricts their use.
Finally, we provide evidence for why a broader philosophical, sociological look at programming concepts should be of interest for programmers. It lets us understand programming concepts better and, fundamentally, choose more appropriate abstractions as illustrated in a number of case studies that conclude the paper.


3.
插件化、热补丁中绕不开的Proguard的坑
一直对proguard混淆感兴趣,可惜未深入看过,本文当入门似乎有点深,但是分析思路很好。

ProGuard是2002年由比利时程序员Eric Lafortune发布的一款优秀的开源代码优化、混淆工具,适用于Java和Android应用,目标是让程序更小,运行更快,在Java界处于垄断地位。
主要分为三个模块:Shrinker(压缩器)、Optimizer(优化器)、Obfuscator(混淆器)、Retrace(堆栈反混淆)。
Shrinker 通过引用标记算法,将没用到的代码移除掉。
Optimizer 通过复杂的算法(Partial Evaluation &Peephole optimization,这部分算法我们不再展开介绍)对字节码进行优化,代码优化会使部分代码块的结构出现变动。
Obfuscator 通过一个混淆名称发生器产生a、b、c的毫无意义名称来替换原来正常的名称,增加逆向的难度。
Retrace 经过ProGuard处理后的字节码运行的堆栈已经跟没有处理之前的不一样了,除了出现名称上的变化还伴随着逻辑上的变化,程序崩溃后,开发者需要借助Retrace将错误堆栈恢复为没有经过ProGuard处理的样子。

本文则主要介绍了Java优化&混淆工具ProGuard的基本原理、ProGuard的几个模块之间的相互关系与影响、以及增量混淆使用-applymapping遇到部分方法映射错乱的Bug,Bug出现的原因以及修复方案。


4.
全栈虚拟机GraalVM初体验
最近公众号/知乎/infoq系列关于GraalVM 引用/收藏也较多的一篇文章:

js 运行在GraalVM之上的javascript命令行
node 跟普通的node一样,区别是运行在GraalVM之上
java 跟普通的java一样,区别是运行在GraalVM之上
lli 运行在GraalVM之上的llvm字节码执行器,C和C++代码会编译成llvm字节码,然后通过它来运行
native-image 预编译程序文件生成快速二进制文件,用于加速启动程序
gu 其它的语言像Python、Ruby和R的支持都是通过gu进行安装的


5.
真空里有什么
一个不明觉厉的回答,事实上,要理解有些困难,传统物理真空就是没有任何物质的空间状态,但是这里我们要理解的真空并不是传统的定义。
一种很民科的解释是,现代科学无法自圆其说,尤其在实验和量子论共同推波助澜下,于是创造了答案里的概念。
可以搜一搜 赛先生 一篇普及真空里有什么的文章。
另一个有趣的问题
自然数之和为什么等于-1/12
https://www.zhihu.com/question/22506418
6.
高性能数据库连接池的内幕
值得一看,一个数据库连接池需要考虑哪些基本问题,也包含几大知名连接池的简单对比,就不详细贴了。
7.
同6,这里推荐一个很好的实现,Springboot 2默认的连接池,HikariCP,这篇文章有更详细的对比
很鸡血的技术文章,也很有趣,不说了,去感受下作者浓浓的技术激情吧:

HiKariCP是数据库连接池的一个后起之秀,号称性能最好,可以完美地PK掉其他连接池,是一个高性能的JDBC连接池,基于BoneCP做了不少的改进和优化。其作者还有另外一个开源作品——高性能的JSON解析器HikariJSON。
它,超快,快到连Spring Boot 2都宣布支持了。
代码体积更是少的可怜,130kb


8.
http://highscalability.com/blog/2018/4/27/stuff-the-internet-says-on-scalability-for-april-27th-2018.html

@kwchang: ‘The internet went from a democratizing free space to having power very centralized; crypto decentralization is a reaction to that’ - @starkness #Angels #cryptointro
Lynn Langit: To me, containers are the new VMs. All this frenzy about containers, and more specifically container management systems — look, somebody has to manage the things. I want to pay the cloud providers to do it so I don’t have to.
@kellabyte: Many-core servers are a huge problem. We have no idea how to write software to actually use the hardware properly. For example, in Go, there’s no IO library that can go faster than 10GbE.
Markus Winand: Don’t say relational database when referring to SQL databases. SQL is really more than just relational.
Catalin Cimpanu: A loud sound emitted by a fire suppression system has destroyed the hard drives of a Swedish data center, downing Nasdaq operations across Northern Europe.
@brendangregg: context switching & CPU cache invalidations are both CPU utilization. I’d look for single-threaded/single-CPU bottlenecks first, then off-CPU analysis.


9.
http://blog.pragmaticengineer.com/distributed-architecture-concepts-i-have-learned-while-building-payments-systems/
Uber工程师的一篇文章:

SLA
Horizontal vs vertical scaling
Consistency
Data Durability
Message Persistence and Durability
Idempotency
Sharding and Quorum
The Actor Model
Reactive Architecture
Closing


上述几点可考虑纳入设计考量点,不多评论了,作者自己总结:

This write-up has been strictly focused on the planning and architecting of these systems. There is a whole lot of things to be said about building, deploying and migrating between high-load systems as well as operating them reliably. But all those topics are other posts.


10.
关于ES shard分配/路由,看完这一篇就够了
https://blog.csdn.net/iceman1952/article/details/79957290
这是一篇译文,原文(Every shard deserves a home)于2016-11-11发布在elastic官方博客,可以保存方便即时查阅。
11.
http://hbasefly.com/2018/05/02/timeseries-database-7/
任何一个数据库系统内核关注的重点无非:数据在内存中如何存储、在文件中如何存储、索引结构如何存储、数据写入流程以及数据读取流程。关于InfluxDB存储内核,笔者在之前的文章中已经比较全面的介绍了数据的文件存储格式、倒排索引存储实现以及数据写入流程,本篇文章重点介绍InfluxDB中时序数据的读取流程
12.
https://www.elastic.co/blog/composite-aggregations-elasticsearch-pizza-delivery-metrics
Composite aggregations are a powerful new feature in Elasticsearch 6.1. To show the full power of the feature, we’ll walk through creating an analytics service for Sliceline, a fictional pizza delivery company.
Composite aggregations allow us to:
Quickly paginate through aggregation results
Build new indices from aggregation results
Develop APIs backed by Elasticsearch aggregations with consistent response times for large result sets
13.
Turning a MacBook into a Touchscreen with $1 of Hardware
https://www.anishathalye.com/2018/04/03/macbook-touchscreen/
只需1美元,作者在自己的MacBook的摄像头前巧妙的加装了一面小镜子,反射到摄像头,捕捉手指对屏幕的触控,并使用视觉识别,将摄像头拍摄的画面转换为触控反馈。
见过很多实现触摸的办法,外接镜面,外接ipad,airbar,本文介绍方法可以说,不仅便宜,而且非常的hack了。
不过不知道触摸效果怎样。