unknown log

Liunx main stat tool - sysstat

Posted in toolbox by stvchu on the July 12th, 2008

http://pagesperso-orange.fr/sebastien.godard/

This is a utility collection, including:

  • iostat(1) reports CPU statistics and input/output statistics for devices, partitions and network filesystems.
  • mpstat(1) reports individual or combined processor related statistics.
  • pidstat(1) reports statistics for Linux tasks (processes) : I/O, CPU, memory, etc.
  • sar(1) collects, reports and saves system activity information (CPU, memory, disks, interrupts, network interfaces, TTY, kernel tables,etc.)
  • sadc(8) is the system activity data collector, used as a backend for sar.
  • sa1(8) collects and stores binary data in the system activity daily data file. It is a front end to sadc designed to be run from cron.
  • sa2(8) writes a summarized daily activity report. It is a front end to sar designed to be run from cron.
  • sadf(1) displays data collected by sar in multiple formats (CSV, XML, etc.) This is useful to load performance data into a database, or import them in a spreadsheet to make graphs.

Google’s data interchange format

Posted in memo by stvchu on the July 12th, 2008

Protocol Buffers: http://code.google.com/p/protobuf/

Another similar format is Facebook’s Thrift.

The Software Behind the Mars Phoenix Lander

Posted in memo by stvchu on the July 12th, 2008

http://news.oreilly.com/2008/07/the-software-behind-the-mars-p.html

Detail about Aerospace Software Engineering, very interesting topic.

Google C++ Testing Framework

Posted in memo by stvchu on the July 5th, 2008

Google’s framework for writing C++ tests on a variety of platforms (Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.

http://code.google.com/p/googletest/

http://googletesting.blogspot.com/2008/07/announcing-new-google-c-testing.html

memcachedb 1.1.0 beta is released

Posted in memcachedb by stvchu on the July 3rd, 2008

*MemcacheDB* is a distributed key-value storage system designed for
persistent. It is NOT a cache solution, but a persistent storage
engine for fast and reliable key-value based object storage and
retrieval. It conforms to memcache protocol(not completed, see below),
so any memcached client can have connectivity with it. Memcachedb uses
Berkeley DB as a storing backend, so lots of features including
transaction and replication are supported.

ChangeLog since 1.0.3 version:

2008-07-03 Version 1.1.0-beta released

2008-06-26 Steve Chu <stvchu@gmail.com>
* unix socket connectivity now has be well tested.

2008-06-13 Steve Chu <stvchu@gmail.com>
* some code refactoring to improve a bit performance

2008-06-11 Steve Chu <stvchu@gmail.com>
* now ‘-b’ option is a tuning way, not a limit. item size that smaller than
‘-b’ value use fast freelist alloc, otherwise, use system ‘malloc’ instead.
Many thanks to Davies Liu <davies.liu@gmail.com> for patches and ideas.

2008-06-03 Steve Chu <stvchu@gmail.com>
* new support to BerkeleyDB 4.7
- new version is BerkeleyDB 4.7 only, due to the changed bdb api
- ‘rep_set_request’ now use time, not the number of messages

* Bugfix: ‘pkget’ and “multiple get” that return lots of items may
cause memory overflow so the daemon crashes. Thanks to Davies Liu
<davies.liu@gmail.com>

* flooded verbose messages of bdb and replication now move to ‘-vv’ option

2008-04-13 Steve Chu <stvchu@gmail.com>
* Changes:
- allow limitation to ‘pkget’ and ‘pvget’ command,
use ‘pkget/pvget <prefix> [limit]‘ to get limited matched items.
- ‘memcache.py’ is also patched for this feature.

2008-04-03 Steve Chu <stvchu@gmail.com>
* New features:
- add ‘-T’ option to set database type, ‘btree’ or ‘hash’
- add ‘-E’ option to enable second database, so we can use ‘pvget’
- new command ‘pkget’ that you can get items with a key prefix
- new command ‘pvget’ that you can get items with a value prefix
* Changes:
- add support to memcache.py for ‘pkget’ and ‘pvget’ command, see
‘tools/memcache.py’

for more info, please visit: http://memcachedb.org

Google C++ Style Guide

Posted in memo by stvchu on the June 30th, 2008

socat - the real swiss army knife

Posted in Uncategorized, tips, toolbox by stvchu on the June 26th, 2008

Try to test memcachedb using tcp and unix socket:

socat - TCP4:127.0.0.1:21201,crnl
socat - UNIX-CONNECT:./mdb.sock,crnl

Homepage: http://www.dest-unreach.org/socat/

Comments Off

state machine drawing with graphviz

Posted in toolbox by stvchu on the June 5th, 2008

Graphviz is a drawing tool forĀ  structural information, and particularly suitable for state machine representation. Here is a sample from lighttpd.net:

// state.dot
digraph state {
  edge [color=green];
  connect -> reqstart -> read -> reqend -> handlereq -> respstart -> write -> respend -> connect;
  edge [color=grey];
  reqend -> readpost -> handlereq [ label="POST" ];
  edge [ color=blue]
  respend -> reqstart [ label="keep-alive" ];
  edge [ color=lightblue]
  handlereq -> handlereq [ label="sub-request" ];
  edge [style=dashed, color=red];
  error -> close -> connect;
  error -> connect;
  handlereq -> error;
  read -> error;
  readpost -> error;
  write -> error;
  connect [shape=box];
}

Output the result:

dot -Tpng -ostate.png state.dot

referer control of nginx

Posted in notes by stvchu on the June 5th, 2008

Http referer control in nginx is easy, it is done by ngx_http_referer_module (enabled by default).
Here the sample conf:

location /demo/ {
         valid_referers   none  blocked  .mydomain.com;
 
         if ($invalid_referer) {
             return   403;
         }
}

The parameters can be as follows:

  • none means the absence of “Referer” header.

  • blocked means masked Referer header by firewall, for example, “Referer: XXXXXXX”.

  • server_names is a list of one or more servers. From version 0.5.33 onwards, * wildcards can be used in the server names.

‘date’ converter

Posted in tips by stvchu on the June 5th, 2008

Convert a timestamp to standard date format:

date -d '1970-01-01 UTC 1212631443 seconds' +"%Y-%m-%d %T %z"

Convert a standard date format to timestamp:

date -d '2008-06-05 10:04:03 +0800' +"%s"