上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
摘要: 一.引言这个问题看似是个很俗气的问题,但是在面试中也是个经常被问到的问题。我想很多人都能说出几条,比如事物,外键,等等。但是我想这样想起一点说一句这么回答的话,知识其实都是分散的,这样就显得不是很高大上。我认为回答这个问题,可以从两个方面来阐述,一个是并发控制方面,还有一个就是索引实现方面。二.并发控制1.myisam是表级锁表锁的意思就是,对整张表加锁,当用户进行写操作(UPDATE INSEART DELETE)时,用户获得一个写锁,写锁会禁止任何用户的读/写操作。举个通俗点的例子来所,比如当一个程序在修改id=1的记录时,这时候任何试图读/写任何记录都会被阻塞。有些人肯定觉得这样很不科学 阅读全文
posted @ 2014-03-01 14:03 23lalala 阅读(1183) 评论(0) 推荐(0) 编辑
摘要: 一.thrift可以做什么thrift是一个跨语言通信的工具,支持的语言多,而且还提供服务器端的众多网络模型,使服务端的开发可以只专于服务本身的逻辑。二.thrift重要概念1.processor实际服务器端业务逻辑处理的实现类。2.transportTTransport主要处理服务器端和客户端的网络读写。主要的接口openclosereadwriteflush例如常用的客户端是TSocket就是TTransport的一个实现在服务器端当有请求来的时候,通过TServerTransport可以创建TTransport对象,然后通过TTransport发送数据给客户端,主要的接口openlist 阅读全文
posted @ 2014-02-08 18:10 23lalala 阅读(1415) 评论(0) 推荐(0) 编辑
摘要: 1.lighttpd 服务器lighttpd是一个比较轻量的服务器,在运行fastcgi上效率较高。lighttpd只负责投递请求到fastcgi。centos输入yum install lighttpd安装 2.fastcgifastcgi解决了cgi程序处理请求每次都要初始化和结束造成的性能问题。fastcgi并且是独立于webserver的,fastcgi的crash并不影响webserver,然后他们之间通过soket通信。与fastcgi不同的另一种解决cgi程序反复创建,销毁的方法是让webserver开放api,然后编写cgi的时候,把cgi嵌入到webserver中,这样有个. 阅读全文
posted @ 2014-01-21 14:51 23lalala 阅读(1375) 评论(0) 推荐(0) 编辑
摘要: 把纯真IP库读到内存,纯真IP库本来就是有序的,然后每次请求二分查找就行,44WIP查找十几次就搞定了dispatch_mode最好写3,不然做服务的时候,会导致进程任务分配不均匀。max_request 处理请求数量累加到达该值会重启处理进程,防止内存泄露worker_num 根据内存和服务处理能力可以自己设置跑几个工作进程。swoole.php array ( 'bj' => '北京', ), 1 => array ( 'sh' => '上海', ... 阅读全文
posted @ 2014-01-16 18:51 23lalala 阅读(1382) 评论(0) 推荐(0) 编辑
摘要: Amazon Interview Question SDE1sGiven a binary tree. Modify it in such a way that after modification you can have a preorder traversal of it using only right pointers. During modification you can use right as well as left pointers. Write complete code and dry run it for some test cases左子树转换后的最右叶子节点的右 阅读全文
posted @ 2014-01-15 14:45 23lalala 阅读(212) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find the total sum of all root-to-leaf numbers.For example, 1 / \ 2 3The root-to-leaf path1->2represents the number12.T 阅读全文
posted @ 2014-01-13 15:02 23lalala 阅读(152) 评论(0) 推荐(0) 编辑
摘要: A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded message"12", it cou 阅读全文
posted @ 2014-01-11 15:09 23lalala 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 参照刘汝佳的trie树 结构体#include "stdio.h"#include "stdlib.h"#include "string.h"#include "malloc.h"/***** 连接字符串和字符 **/char* strcatch(char *str, char ch) { char *p = str; while (*p!='\0') { p++; } *p = ch; *(p+1) = '\0'; return str;}//最大节点数 小于最大单词长度*单词数 阅读全文
posted @ 2014-01-10 12:14 23lalala 阅读(895) 评论(0) 推荐(0) 编辑
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"public class Solution { /** * 也可以参考http://blog.csdn.net/u01 阅读全文
posted @ 2014-01-06 14:23 23lalala 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?public class Solution { public int singleNumber(int[] A) { int ret = A[0]; for(in... 阅读全文
posted @ 2014-01-06 11:42 23lalala 阅读(114) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页