世界属于将思考付诸实践的人

警察以后能否提高速度

类归于: 杂谈&日志 — colin @ 8:38 下午 2006年12月30日

晚上回家路过人人乐超市(深圳),看到一个饭馆门口好热闹,一群人在围观,里边有几个人挥舞着铁棍,旁边站着超市的巡警,有几个人尝试去劝阻,但是无济于事。

9点33分。我打了110,告诉接线员位置,接线员说马上赶到。

9点39分。冲突缓解。

9点44分,冲突正式结束。

9点50分,人群散开。警察未到。

希望警察同志到2007年能够提高办事速度。

Share/Save/Bookmark

libevent

类归于: Open Source, Web开发 — colin @ 6:40 下午 2006年12月12日

最近在做各种Http Server性能比较,在同一台Linux开发机上,同样业务逻辑的情况下,用以下几种方式进行压力测试:

apache2.2+mod_php
apache2.2+cgi(fork)
基于多线程任务式epoll模型的自写http server
基于libevent(封装了epoll)的自写http server

目前只是测试大并发情况下的接入能力,具体的连接数情况以后有时间我会写出来,在这里只是推荐大家在某些Server中使用libevent作为底层通信事件模型,libevent在2.6内核的linux中会自动使用/dev/epoll,基于kernel mode到user mode的事件通知,最大的好处是不会随着连接数的增多而导致fd检查的速度下降,传统的select和poll都有着先天的不足。

libevent - an event notification library

http://www.monkey.org/~provos/libevent/

http://www.monkey.org/~provos/libevent/event3.html

Share/Save/Bookmark

crawl - a small and efficient HTTP crawler

类归于: Open Source, Web开发 — colin @ 6:39 下午 2006年12月07日

http://www.monkey.org/~provos/crawl/

The crawl utility starts a depth-first traversal of the web at the specified URLs. It stores all JPEG images that match the configured constraints. Crawl is fairly fast and allows for graceful termination. After terminating crawl, it is possible to restart it at exactly the same spot where it was terminated. Crawl keeps a persistent database that allows multiple crawls without revisiting sites.

The main reason for writing crawl was the lack of simple open source web crawlers. Crawl is only a few thousand lines of code and fairly easy to debug and customize.

Features

  • Saves encountered images or other media types
  • Media selection based on regular expressions and size contraints
  • Resume previous crawl after graceful termination
  • Persistent database of visited URLs
  • Very small and efficient code
  • Asynchronous DNS lookups
  • Supports robots.txt

Share/Save/Bookmark