Tip: 看不到本站引用 Flickr 的图片? 下载 Firefox Access Flickr 插件 | AD: 订阅 DBA notes -- ![]()
2009-07-02 Thu
1. 作事的安全;
2. 用人的安全。
考查一个团队优劣的标准,我认为只有一点,那就是,“把事作好”。所以,不管是民主也好,控制也罢,其最终目的都是为了把事作好。说,我们放开限制,让大家每一个人都自由发展,而其实,并不是每个人都能把握住这样的机会,甚至并不是每个人都需要这样的机会。所以,我们决策者自己,对自由发展的效果要作到心中有数,自己给自己一个低估值,随时准备在最关键的时刻自己亲自上阵。
说起来可能会觉得很可悲,但无数的事实一再告诫我们,这个世界上,在那些最关键的时刻,往往只有自己才靠得住,甚至,连自己都靠不住。因为是人就总有懈怠、不经意甚至自私的时候,而每当此时,都是我们更容易犯错,项目更容易出问题的时候。
在网游产品运营的过程中,经常会遇到非常多的突发事件,特别是与安全相关的突发事件,比如物品复制,刷钱等等,我们在处理此类问题的过程中,所积累下来的一个良好习惯是:不仅要解决当前的这个问题,还要向上更进一层,看看如何从机制上作得更安全。
机制的安全,是一个永无止境的改进过程,新的需求、新的改动总会引出新的问题,我们无法从技术层面作到完全的杜绝,最主要的,还是要不断敲响警钟,让每一个开发者都绷紧一根弦,都能到达“闻刷色变”的心理状态,小心翼翼,战战兢兢。
多年来,我们磨练出的一个最好品质就是:快速响应,而且,是整个团队,自上而下,自内而外的。关于这一点,可能这一次与我们产品团队合作的市场团队同事印象会比较深刻,我们对于前线需求的响应速度可能在公司内部是前所未有的。
在我们的团队中,我们也从始至终在贯彻一种理念和作事的方法:在这个团队中,没有谁不可被替代,包括我自己。我对这个团队进行培养的最终目标,就是如果有一天我离开这个团队,它仍然可以按照我们既往积累下来的流程、经验和方法把项目和产品顺利的作下去。从这套作事的方法上,我们就在避免把某一个人刻意塑造为项目中不可替代的核心人物,也绝不会允许任何开发者以“讨价还价、以走相胁”的方法获得自己想要的利益,在这个团队中,任何利益的获得,都是因为你对项目本身作出的贡献,而不是其它。
广撒网,精耕作。有些烂泥压根就是扶不上墙的,我们自己要有这个心理准备。要把机会留给那些真正能作事、能担得起责任、心中装着大家而不自私的人。有才者,可以攻一役;而有才有德者,方可统领千军。
作者:Fenng 发布在 dbanotes.net.
去年在对 SSD 做调查的时候就关注过这个五分钟法则,今天又发现了这篇文章的修订版(为了纪念 Jim Gray),这个话题倒是可以简单介绍一下,对架构师衡量 I/O 能力、Cache 评估和做硬件选型还是会有一些帮助的。
在 1987 年,Jim Gray 与 Gianfranco Putzolu 发表了这个"五分钟法则"的观点,简而言之,如果一条记录频繁被访问,就应该放到内存里,否则的话就应该待在硬盘上按需要再访问。这个临界点就是五分钟。看上去像一条经验性的法则,实际上五分钟的评估标准是根据投入成本判断的,根据当时的硬件发展水准,在内存中保持 1KB 的数据成本相当于硬盘中存储同样大小数据 400 秒的开销(接近五分钟)。这个法则在 1997 年左右的时候进行过一次回顾,证实了五分钟法则依然有效(硬盘、内存实际上没有质的飞跃),而这次的回顾则是针对 SSD 这个"新的旧硬件"可能带来的影响。

随着闪存时代的来临,五分钟法则一分为二:是把 SSD 当成较慢的内存(extended buffer pool )使用还是当成较快的硬盘(extended disk)使用。小内存页在内存和闪存之间的移动对比大内存页在闪存和磁盘之间的移动。在这个法则首次提出的 20 年之后,在闪存时代,5 分钟法则依然有效,只不过适合更大的内存页(适合 64KB 的页,这个页大小的变化恰恰体现了计算机硬件工艺的发展,以及带宽、延时)。
根据数据结构和数据特点的不同,对于文件系统来说, 操作系统倾向于将 SSD 当作瞬时内存(cache)来使用。而对于数据库,倾向于将 SSD 当作一致性存储来用。
这是一篇非常重要的文章(所以,建议读一下原文),其中对于数据库一节的描述尤其有趣(针对 DB 也有个五分钟)。限于篇幅,就不罗嗦了。
--EOF--
相关文章|Related Articles
- Oracle 10g XE 的字符集问题 - Jan 23, 2006
- Oracle XE 自带的数据库如何创建的? - Jan 24, 2006
- 重要图书: MySQL Stored Procedure Programming - Apr 10, 2006
- 代寻《Database In Depth》的技术审校 - Oct 12, 2006
评论数(1)|添加评论 | 最近作者还说了什么? Follow Fenng@Twitter
本文网址:http://www.dbanotes.net/arch/five-minute_rule.html
DBA Notes 理念: 用简约的技术取得最大的收益...
2009-07-01 Wed
For the last couple of months, we've been quietly developing a MySQL protocol parser for Maatkit. It isn't an implementation of the protocol: it's an observer of the protocol. This lets us gather queries from servers that don't have a slow query log enabled, at very high time resolution.
With this new functionality, it becomes possible for mk-query-digest to stand on the sidelines and watch queries fly by over TCP. It is only an observer on the sidelines: it is NOT a man in the middle like mysql-proxy, so it has basically zero impact on the running server (tcpdump is very efficient) and zero impact on the query latency. There are some unique challenges to watching an entire server's traffic, but we've found ways to solve those. Some of them are harder than others, such as making sense of a conversation when you start listening in the middle. In general, it's working very well. We can gather just about every bit of information about queries that mysql-proxy can, making this a viable way to monitor servers without the disadvantages of a proxy. In theory, we can gather ALL the same information, but in practice we are going for the 95% case.
As always with Maatkit, this has minimal dependencies. It doesn't require any Net::Pcap or other modules from CPAN. It's written in pure Perl, and it parses the output of tcpdump, rather than watching the network traffic directly. This might sound useless, but it's not. It means you can go tcpdump some traffic on a machine without Perl installed, and copy it to another machine for analysis, or send it via email to your friendly consultant, or do any of a number of other things. Decoupling things is very helpful sometimes.
Let's see how to gather queries and do something useful with them. I'll just watch the queries on a sandbox server on my laptop, and print out the profile synopsis so you can see how it works.
-
sudo tcpdump -i lo port 3306 -s 65535 -x -n -q -tttt> tcpdump.out
I run a few queries, quit, and cancel tcpdump. Now I've got a file and I'm ready to analyze it. Let's see:
-
mk-query-digest --type=tcpdump --report-format=profile tcpdump.out
-
# Rank Query ID Response time Calls R/Call Item
-
# ==== ================== ================ ======= ========== ====
-
# 1 0x088084BF139954D8 0.1009 90.2% 1 0.100881 SELECT dual
-
# 2 0x261703E684370D2C 0.0110 9.8% 1 0.011017
I'm kind of showing off the summary profile here to illustrate that you can get really compact results to see what's going on inside your server. What do you suppose that one query was that took a tenth of a second? We can find out.
-
mk-query-digest --type=tcpdump --limit 1 tcpdump.out
-
# 460ms user time, 30ms system time, 8.88M rss, 11.79M vsz
-
# Overall: 8 total, 6 unique, 0.15 QPS, 0.00x concurrency ________________
-
# total min max avg 95% stddev median
-
# Exec time 114ms 0 101ms 14ms 100ms 33ms 737us
-
# Hosts 8
-
# Time range 2009-07-01 23:55:41.334082 to 2009-07-01 23:56:33.929945
-
# bytes 215 14 49 26.88 46.83 9.76 26.08
-
# Errors 8
-
# Rows affe 0 0 0 0 0 0 0
-
# Warning c 0 0 0 0 0 0 0
-
# 0% No_good_index_used
-
# 12% No_index_used
-
-
# Query 1: 0 QPS, 0x concurrency, ID 0x088084BF139954D8 at byte 7517 _____
-
# This item is included in the report because it matches --limit.
-
# pct total min max avg 95% stddev median
-
# Count 12 1
-
# Exec time 88 101ms 101ms 101ms 101ms 101ms 0 101ms
-
# Users 1 msandbox
-
# Hosts 1 127.0.0.1
-
# Databases 1
-
# Time range 2009-07-01 23:56:31.022602 to 2009-07-01 23:56:31.022602
-
# bytes 22 49 49 49 49 49 0 49
-
# Errors 1 none
-
# Rows affe 0 0 0 0 0 0 0 0
-
# Warning c 0 0 0 0 0 0 0 0
-
# 0% No_good_index_used
-
# 0% No_index_used
-
# Query_time distribution
-
# 1us
-
# 10us
-
# 100us
-
# 1ms
-
# 10ms
-
# 100ms ################################################################
-
# 1s
-
# 10s+
-
# Tables
-
# SHOW TABLE STATUS LIKE 'dual'\G
-
# SHOW CREATE TABLE `dual`\G
-
# EXPLAIN
-
select 1 from ( select sleep(.1) from dual ) as x\G
Indeed, it's no surprise the query took a tenth of a second to execute, and now you see where "SELECT dual" comes from.
Notice that it is inspecting the protocol enough to see the flags set in the protocol, indicating the warning count, error count, rows affected, and whether no index or no good index was available. Look at the top of the report -- what is up with the 12% of queries that say No_index_used? If we increase --limit a bit, we can see
-
# 0% No_good_index_used
-
# 100% No_index_used
-
# Query_time distribution
-
... snip ...
-
show databases\G
I did not know that SHOW DATABASES sets the "no index used" flag, did you? Now we both do!
This is just a brief introduction to what the protocol parser can do. Of course, in real life it's much more useful than just seeing a query or two -- it has all the power of mk-query-digest for filtering, aggregating, printing and so forth.
Entry posted by Baron Schwartz | No comment
而实际上大家也发现,从Oracle10g开始,Redo Log Buffer缺省的已经是大大超过了原来的想象。
从Oracle 9i引入了Granule的概念后,在Oracle10g中,Oracle的内存分配会为'Fixed SGA Size'和'Redo Buffers'共享整数倍个Granule。
看看不同SGA设置下的内存分配情况:
SQL> select * from v$version;在另外的系统中,供分配了2个Granule,每个4M:
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select * from v$sgainfo where name in ('Fixed SGA Size','Redo Buffers','Granule Size');
NAME BYTES RES
-------------------------------- ---------- ---
Fixed SGA Size 1267212 No
Redo Buffers 15507456 No
Granule Size 16777216 No
SQL> select sum(bytes)/1024/1024 from v$sgainfo where name in ('Fixed SGA Size','Redo Buffers');
SUM(BYTES)/1024/1024
--------------------
15.99757
SQL> select * from v$sgainfo where name in ('Fixed SGA Size','Redo Buffers','Granule Size');摘录一部分Oracle文档中关于Granule的描述供参考:
NAME BYTES RES
-------------------------------- ---------- ---
Fixed SGA Size 1263320 No
Redo Buffers 7122944 No
Granule Size 4194304 No
SQL> select sum(bytes)/1024/1024 from v$sgainfo where name in ('Fixed SGA Size','Redo Buffers');
SUM(BYTES)/1024/1024
--------------------
7.99776459
With dynamic SGA, the unit of allocation is called a granule. Components, such as the buffer cache, the shared pool, the java pool, and the large pool, allocate and free SGA space in units of granules. Oracle tracks SGA memory use in integral numbers of granules, by SGA component. All information about a granule is stored in a corresponding granule entry. Oracle maintains the state of each granule in the granule entry and the granule type.
Granule size is determined by total SGA size. On most platforms, the size of a granule is 4 MB if the total SGA size is less than 128 MB, and it is 16 MB for larger SGAs. There may be some platform dependency, for example, on 32-bit Windows NT, the granule size is 8 MB for SGAs larger than 128 MB.
The granule size that is currently being used for SGA can be viewed in the view
V$SGA_DYNAMIC_COMPONENTS. The same granule size is used for all dynamic components in the SGA.Oracle keeps information about the components and their granules in a scoreboard. For each component that owns granules, the scoreboard contains the number of granules allocated to the component, any pending operations against this component, the target size in granules, and the progress made toward the target size. The start time of the operation is also logged. Oracle maintains the initial number of granules and the maximum number of granules for each component.
For operations that modify the number of granules, Oracle logs the operation, the target size, and the start time to the appropriate SGA component in the scoreboard. Oracle updates the progress field until the operation is complete. When the operation is complete, Oracle replaces the current size with the target size and clears the target size field and the progress field. At the end of the operation, a database administrator can see how the number of granules was changed. Oracle updates the initialization parameter values to reflect the updated amount of SGA in use.
Oracle maintains a circular buffer of the last 100 operations made to the scoreboard. Fixed views show the state of the scoreboard and the current contents of last 100 operations to the scoreboard.
Allocating Granules at Startup
At startup, Oracle reads the values in the initialization parameter file, queries the operating system memory limits, and allocates virtual address space for the SGA. The initialization parameter
SGA_MAX_SIZEspecifies the maximum size of the SGA for the life of the instance in bytes. Its value is rounded up to the next granule size.Adding Granules to Components
A database administrator grows a component's SGA use with
ALTERSYSTEMstatements to modify the initialization parameter values. Oracle takes the new size, rounds it up to the nearest multiple of 16MB, and adds or takes away granules to meet the target size. Oracle must have enough free granules to satisfy the request. If the current amount of SGA memory is less thanSGA_MAX_SIZE, then Oracle can allocate more granules until the SGA size reachesSGA_MAX_SIZE.
相关文章|Related Articles
- 关于Oracle归档进程的运行机制
- 关于Oracle归档进程的运行机制
- 关于《深入浅出Oracle》中granule的补充
- 设置ARCHIVE_LAG_TARGET 强制日志切换
- 磁盘IO故障 导致Redo损坏一例
评论数量(0)|Add Comments
本文网址:http://www.eygle.com/archives/2009/07/granule_log_buffer.html
Dear community,
The release 0.8 of the opensource backup tool for InnoDB and XtraDB is available for download.
Key features:
- New mode of innobackupex --stream=tar4ibd; new command tar4ibd based on libtar-1.2.11
- Experimental option --export is added (see Vadim's post "Impossible - possible, moving InnoDB tables between servers"for details)
tar4ibd is made to be sure that read of InnoDB page is consistent. Before we had some complains what in stream mode some pages are getting corrupted, and we suspect tar can do read of pages in time when they changed. So we patches libtar to make read consistent.
Export is added to support moving .ibd tablespaces between servers.
The list of other features in the release includes:
- Support of ARCHIVE tables
- Addded incremental option to innobackupex-1.5.1 script
- Rollback XA PREPAREd transaction automatically at --prepare
- To extend tablespace size, if needed after --prepare
- Data page corruption check is added to local backup mode
- innobackupex can pass --export option
- Bug #389360: innobackupex-1.5.1 accepts scp options
Fixed bugs:
- Bug #388062: Update to innobackupex to include incremental
- fix error handling of tar stream
The binary packages for RHEL4,5, Debian, FreeBSD as well as source code of the XtraBackup is available on http://www.percona.com/mysql/xtrabackup/0.8/.
The project lives on Launchpad : https://launchpad.net/percona-xtrabackup and you can report bug to Launchpad bug system:
https://launchpad.net/percona-xtrabackup/+filebug. The documentation is available on our Wiki.
For general questions use our Pecona-discussions group, and for development question Percona-dev group.
For support, commercial and sponsorship inquiries contact Percona.
Entry posted by Aleksandr Kuzminsky | 3 comments
作者:Fenng 发布在 dbanotes.net.
金庸小说中的美女? 这可能是一个比较老的话题了。如果"到Google上百度一下",能找到不下百万条的记录结果。之所以会有这么多结果,可能和每个读者心目中的理想美女标准不一吧。
尽管是个老掉牙的话题,考虑到公司(注:阿里巴巴集团)崇尚武侠文化,所以唠叨几句,再做点普及可能也不算过时。有些人物形象,比如黄蓉小龙女等已是深入人心,再此略过不表。再者,美与不美是相对的,比如《《天龙八部》中的怪人包不同就觉得自己女儿包不靓最美嘛。
小昭
小昭是金庸最喜欢的女性人物。其容貌"双目湛湛有神,修眉端鼻,颊边微现梨涡,直是秀美无伦",我们又从文中得知小昭生父韩千叶系中土人士,其母黛绮丝人家还是波斯的圣女,居然是个混血儿,考虑到遗传因素,所以美貌自不待言,比一般的美女更美也是情理之中的事情。
小昭武功不弱,聪明伶俐,通音律,且精通奇门八卦之术,绿柳庄外曾救得群雄性命,从这一点来看,人家是个完美的知识女性,用现在的话说,那叫知性美女。小昭对爱情忠诚,富有牺牲精神,最后为了张无忌而痛心远走波斯,这是颇为读者神伤的一段。
小昭恐怕也是金庸先生心目中的理想女性的化身,另外一个和她人物形象有点重叠的是双儿,当然,双儿更多了一点温柔(所以能得圆满?)。类似的女性人物形象在金庸作品中出现两次,可见作者心目中的理想美女亦相去不远。暗自揣测,这两个人物形象或许是参照金庸第三任妻子林乐怡而写的,当然这个一家之言,还有待考证。
小昭堪称金庸小说中的绝顶佳人。不知道是否有武侠小说迷按照这个标准寻找意中人的,哈哈。
郭襄
《神雕侠侣》中的郭襄,是金庸所有小说中最具亲和力的人物,"潇洒如诗",也是金庸所有小说中最闪亮的配角人物,一见难忘,所以让何足道与张三丰"为君沉吟"。
痴情者如郭襄者,少见又少见。"天涯思君不敢忘",一遇杨过误终身,爱慕杨过而不可得,杨过喜欢的那句话"世间不如意者,十居七八"倒应在了她身上。不是有人说了么,"得不到的东西最美好",如果郭襄真的能和杨过在一起,反而未必那么圆满,"得不到的东西最美好",但愿如此。郭襄这样的女子当今社会怕是没有了----都直接当小三去了。顺便说一下,郭襄的徒孙周芷若是金庸小说中相当令人生厌的人物,从某种角度上看,不亚于康敏。
王语嫣家族女性
看来遗传因素决定了一切,王语嫣一家的女性貌似都貌美得不得了。好像只有他妈王夫人稍微差了一点,估计隔代遗传的因素作怪吧。容貌归容貌,这个家族的人物性格并不讨人喜欢。
在最近新修版的《天龙八部》中,王语嫣的人物形象较之先前有了较大改变,最后热衷寻求长生不老之术,幻想青春永驻。个人认为,这是金庸小说中体现的西方神话形象那西塞斯(Narcissus)的女性版。以王语嫣为代表的女性可能是美女,但非常无趣。如果段誉娶了这样的媳妇,绝对糟糕透顶。王语嫣可算上美女,但无论如何不是佳人。
冯蘅
这是一个必须一提的人物。也是个相对比较陌生的名字,冯蘅是谁? 黄蓉她妈,黄药师的妻子。
仅仅通过其他人物的口中就已经能够得知绝代风貌,且不说黄药师如此另类人物被其折服,其过目不忘之能也当世少有,令人心驰神往,原来美貌与智慧是可以并存的。考虑到黄蓉同学多少只是他母亲的影子,加上大家太熟悉这个角色,不复赘言。
新修版中居然情节更改为黄药师因为弟子们说闲话而斗气娶了冯蘅,实在是大煞风景。这个变动相当的蛇足。
程灵素
金庸先生书中女主人公绝大多数都算美女,但程灵素除外。"头发稀疏,肌肤枯黄,脸有菜色",如果分析一下,可能是这个古代化学专家整天接触药石之故,如果放到现在,人家就是个化学兼医学双料女博士,外表不美,心灵美,这也顶顶重要。其实内在美重要,还是外在美重要,不同的历史时期人们的价值取向也是不同的,也或许有人喜欢程灵素也说不定。
程灵素最后为胡斐牺牲,不由得让人埋怨作者下笔残酷,如果武侠小说允许假设,那么胡斐娶了程灵素是不会让人感到意外的。
香香公主
香香公主之美,美到不够真实,而其不谙世事,也似乎不是凡间之人。激战双方的兵士见到她居然"便似中邪昏迷一般,人人都呆住了...无数长矛都掉下地来,弓箭手的弓矢也收了回来...人人神色和平,收刀入鞘",如果在今天,维护世界和平旧靠她了:) 塑造这个小说人物的时候恐怕也多少投射了一些西方经典美女海伦的有关因素在里面吧。
金庸早期小说人物形象多半缺乏立体感,香香公主也是如此,甚至在同一部小说中,还不如霍青桐更能赢得人好感。
陈圆圆
当然,香香公主再美,可能还敌不过陈圆圆,陈圆圆有多美,无法形容(所以不可能留下'西施捧心'之类的形象给世间人)!因为无法形容,所以作者描写陈圆圆多用映衬笔法,纵观全部金庸小说,这是相当精彩的地方,丝毫不亚于纯文学作品。在《碧血剑》中曾有一幕,写到闯王帐下群雄见到当世第一美人莫不疯狂,甚至袁承志这样的人见到她也是心中荡漾。多年之后,韦小宝第一次见到陈圆圆时虽已韶华不再,但风韵不减当年,仍禁不住"张大了口竟然合不拢来...";再说,女儿阿珂都把韦小宝震撼得"我要死了",更别说人家老娘了。
貌美不是好事情,汉族文化的传统思维是红颜祸水,其实"冲冠一怒为红颜"关卿何事? 不过是政治家争权夺势的借口罢了。陈圆圆终其一生,何其不幸也。在吴三桂和李自成这两个枭雄中间注定得不到得不到幸福,更为天下人唾骂,这也是造化使然。金庸小说中的陈圆圆,是不折不扣的悲剧形象,其后半生青灯古佛,心怀天下苍生,那是万分难得的菩萨心肠了。
最后多说一笔,如果陈圆圆不那么美貌的话,恐怕中国历史要改写吧? 当然,这个有点扯远了,否则,该有同学说"丘处机不该路过牛家村"这回事儿了。
--EOF--
金庸小说本来是网友写烂了的题材。这是给公司内刊投稿的文章(美女题材在家里是个禁忌,我这也是冒着被老婆揍的风险)。算是重温了一下渐行渐远的武侠文化吧。
相关文章|Related Articles
- 鸠摩智-没有了屠刀才成为好人 - Jul 4, 2005
- 任我行-大独裁者 - Jul 4, 2005
- 周芷若-初恋情人反目成仇 - Jul 4, 2005
- 归辛树--笨蛋神拳失败教育家 - Jul 4, 2005
评论数(8)|添加评论 | 最近作者还说了什么? Follow Fenng@Twitter
本文网址:http://www.dbanotes.net/mylife/beauty.html
DBA Notes 理念: 用简约的技术取得最大的收益...
2009-06-30 Tue
AnySQL.net
Oracle & Starcraft
Give you some color to see see!
Oracle Scratchpad
Oracle Life
OracleDBA Blog---低调做人,高调做事!
Chanel [K]
xzh2000的博客
Oracle Security Blog
ERN空间
MySQL Performance Blog
The Tom Kyte Blog
Delicious/Fenng/oracle
AIXpert
O'Reilly Databases
Red Hat Magazine
DBASupport
developerWorks 中国 : 技术文章 , 教程 AIX
车东[Blog^2]
blue_prince
玉面飞龙的BLOG
此生 今世
人生就是如此
Orange Tiger 木匠 Creative and Flexible - go with flow
生活帮-LifeBang
Hey!! Sky!
dba on unix
Brotherxiao's Home
柔嘉维则@life.oracle.eng
Fenng's shared items in Google Reader
jametong's shared items in Google Reader
缥缈游侠-logzgh
DBA Tools
ilonng
yangtingkun
Inside the Oracle Optimizer - Removing the black magic
DBA@Taobao
存储部落
Simon Space
Alibaba DBA Team
Oracle Team @SNC
OracleBlog.cn
知道分子
支付宝官方 Blog - 支付志
DBA notes
DBA日记
Fenng 的最新日记
木匠的天空 Oracle Architect and Developer
Hello DBA




