2016年12月14日

MySQL索引原理和慢查询优化

摘要: MySQL用的是B+ tree索引。数据是存储在磁盘上的,所以如果是索引是基于二叉树的话,这样涉及到很多次的磁盘I/O,I/O次数取决于树的高度,大大降低了查询的速度。使用B+树这种多路搜索树结构,可以三次I/O实现百万级数据的查询。 建立索引的原则: 最左前缀匹配原则,非常重要的原则,mysql会 阅读全文

posted @ 2016-12-14 11:58 touchdown 阅读(262) 评论(0) 推荐(0) 编辑

2016年12月13日

浏览器中输入google.com,点击回车后会发生什么?

摘要: 解析URL 浏览器能够通过URL知道下面信息: Protocol:http ->使用http协议 index: "/",请求主页 1. 浏览器从缓存中查询域名 2. 如果缓存中没有,进行DNS查询,分为本地DNS服务器和ISP缓存服务器 3. 浏览器得到目标IP地址和相应的port,然后建立sock 阅读全文

posted @ 2016-12-13 13:18 touchdown 阅读(118) 评论(0) 推荐(0) 编辑

2016年12月11日

abstract class and interface

摘要: Interface separates what a Class does and how does it work. List interface lets different type of List to implement its own method. interface has more 阅读全文

posted @ 2016-12-11 09:10 touchdown 阅读(86) 评论(0) 推荐(0) 编辑

final, static

摘要: static class is used to when you don't need to instantiate the class. Like Math class, instantiating it is unnecessary. Final class prevents extension 阅读全文

posted @ 2016-12-11 02:00 touchdown 阅读(139) 评论(0) 推荐(0) 编辑

2016年12月4日

为什么重写equals方法必须重写hashCode?

摘要: 如果两个对象调用equals返回相等,那么这两个对象调用hashCode方法必须返回相同的整数。如果不重写hashCode,会违反该原则。这个原则主要针对的是映射操作(map接口)。 注意: 1. String重写了Object的equals,现在比较的是两个String所包含的char seque 阅读全文

posted @ 2016-12-04 02:10 touchdown 阅读(94) 评论(0) 推荐(0) 编辑

2016年11月12日

一致性哈希(Consistent Hashing)

摘要: 传统来讲,数据的存储位置是通过hash(object)%N来计算的,这样造成的问题是如果新的机器添加进来或是某台机器down掉了,通过这种算法计算出来的存储位置会和以前的不同,造成了大量数据的迁移,如果有新的机器添加进来也会造成同样的问题,所以容错性和扩展性都不好。一致性哈希算法的主要目的是尽量减少 阅读全文

posted @ 2016-11-12 04:56 touchdown 阅读(112) 评论(0) 推荐(0) 编辑

2016年2月19日

Java generics

摘要: Prior to Java 5, there are a lot of casting in collections, since in collection you add objects and cast the object you get back from collection. Prov 阅读全文

posted @ 2016-02-19 01:39 touchdown 阅读(155) 评论(0) 推荐(0) 编辑

2016年2月14日

If application data needs to be sent to IP address xx.xx.xx.xx, how does it work in underneath network?

摘要: This is to illustrate the communication between two separate machines which don't have a direct physical connection. Application data is generated and 阅读全文

posted @ 2016-02-14 01:18 touchdown 阅读(154) 评论(0) 推荐(0) 编辑

2016年2月4日

Projects_Tweets Analysis

摘要: This is a course project of real time big data analysis. My idea is to use tweets to extract trending topics and analyze political popularity using Ha 阅读全文

posted @ 2016-02-04 22:32 touchdown 阅读(142) 评论(0) 推荐(0) 编辑

2016年2月3日

Recommendation Systems

摘要: The key data that drives most recommendation systems is user behavior data. There are two main types of user behavior data: implicit user feedback dat 阅读全文

posted @ 2016-02-03 04:02 touchdown 阅读(176) 评论(0) 推荐(0) 编辑

导航