May 2010 Archives

性能问题

| No Comments | No TrackBacks

记点笔记:High-Performance Server Architecture

性能问题一般因以下四个原因而起:

  1. Data copies(数据复制)
  2. Context switches(上下文切换)
  3. Memory allocation(内存分配)
  4. Lock contention(锁争用)

为避免Data copies,作者使用的方法是间接使用和通过buffer descriptor来代替buffer pointer,每一个buffer descriptor由以下部分构成:

  • A pointer and length for the whole buffer. 一个指向整个buffer的指针和大小。
  • A pointer and length or offset and length for the part of the buffer that's actually used. 一个指向buffer实际使用部分的指针和大小或偏移量及大小。
  • Forward and back pointers to other descriptors in a list. 指向其他描述符的向前及向后的指针列表。
  • a reference count. 一个引用计数。
但是作者并不推荐在所有情况下都这样用做,因为在描述符的链表中穿行是非常痛苦的,这个做法虽然提高了性能但是却比data copies更恶。最好的做法是标记所有较大的对象,比如说数据块,确保他们像上述那样被独立分配,这样他们就不会被复制了。另外也说了一些因避免复制而做出的更坏的事情,比如强制一个上下文切换,分解一个大的IO请求。为避免Data copies,第一个要关心的应该是如何避免额外的操作。

HS: sify.com的构架

| No Comments | No TrackBacks
刚才看过了High Scalability的新文:SIFY.COM ARCHITECTURE - A PORTAL AT 3900 REQUESTS PER SECOND。构架里有许多有意思的地方,他们在GFS上存储所有数据,没有DB,没有NoSQL,而是使用Apache Solr来做数据的索引。使用了Drools这个rule引擎来处理缓存过期的问题。文章的最后把他们在构架进化过程的问题也抛出来了,这一点很不错,弯路谁没走过,把这样的经验分享出来是相当不错的。 从抛出来所遇到的问题和解决方法来看,系统重启以解决还是相当的普遍。
Reblog this post [with Zemanta]

About this Archive

This page is an archive of entries from May 2010 listed from newest to oldest.

March 2010 is the previous archive.

June 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.