カテゴリ別 2003年 | 2004年 | 2005年 | 2006年 | 2007年 | 2008年
知り合いサイト: よんだもの / 暴想 / Linuxでやる夫 / 新宿Vipper / 僕だけが幸せになればいいのに。
今までこのサイトはメインの Windows マシン上の Cygwin Apache で運営していましたが、あまり安定しないのと電気代を食いそうなのとで、Linux に移行しました。適当に 404 ページを見るとわかりますが、9/1に買った Cube 型 PC に Gentoo Linux をインストールして使ってます。Gentoo のパッケージ管理は楽でいいですね。Ruby のライブラリなど標準にないものは見よう見まねで ebuild を書いてインストールしてます。
#!/usr/bin/env ruby
require 'xmlrpc/server'
server = XMLRPC::Server.new(10080)
class WeblogUpdates
def ping(name, url)
{ "flerror" => false, "message" => "Tanks for the ping" }
end
end
server.add_handler("weblogUpdates", WeblogUpdates.new)
server.serve
#!/usr/bin/env ruby
require 'xmlrpc/client'
name = ARGV.shift
url = ARGV.shift
connection = XMLRPC::Client.new("localhost", "/RPC2", 10080)
result = connection.call("weblogUpdates.ping", name, url)
puts "message: " + result["message"]
$ruby ping_server.rb & [Thu Sep 11 13:03:08 2003] HttpServer 127.0.0.1:10080 start $ruby ping_client.rb my_blog http://www.example.com/blog/ [Thu Sep 11 13:03:47 2003] HttpServer 127.0.0.1:10080 client:40594 some.where.example.jp<127.0.0.1> connect [Thu Sep 11 13:03:47 2003] HttpServer 127.0.0.1:10080 client:40594 disconnect message: Tanks for the ping
#!/usr/bin/env ruby
require 'xmlrpc/server'
server = XMLRPC::CGIServer.new
class WeblogUpdates
def ping(name, url)
{ "flerror" => false, "message" => "Tanks for the ping" }
end
end
server.add_handler("weblogUpdates", WeblogUpdates.new)
server.serve
#!/usr/bin/env ruby
require 'xmlrpc/client'
name = "MyBlog"
url = "http://www.example.com/blog/"
connection = XMLRPC::Client.new("localhost", "/cgi-bin/ping_server.cgi", 80)
result = connection.call("weblogUpdates.ping", name, url)
puts "message: " + result["message"]
require 'rexml/document'
require 'rexml/streamlistener'
module WeblogUpdates
class Handler
include REXML::StreamListener
attr_reader :weblog_updates
def tag_start(name, attrs)
case name
when "weblogUpdates"
@weblog_updates = WeblogUpdates.new(attrs["version"], attrs["updated"], attrs["count"].to_i)
when "weblog"
weblog = Weblog.new(attrs["name"], attrs["url"], attrs["when"].to_i)
@weblog_updates.add(weblog)
end
end
end
class Parser
def self.parse(xml_source)
parser = Parser.new
parser.parse(xml_source)
end
def parse(xml_source)
handler = Handler.new
REXML::Document.parse_stream(xml_source, handler)
handler.weblog_updates
end
end
class WeblogUpdates
include Enumerable
def self.load(filename)
Parser.parse(File.new(filename))
end
def self.create(xml_source)
Parser.parse(xml_source)
end
attr_accessor :version, :updated, :count, :weblogs
def initialize(version=nil, updated=nil, count=nil)
@version = version
@updated = updated
@count = count
@weblogs = []
end
def add(weblog)
@weblogs << weblog
end
def each
@weblogs.each do |weblog|
yield weblog
end
end
def save(filename)
File.open(filename, 'w') do |f|
f.puts(self.to_s)
end
end
def to_s
str =<<-_XML_
<?xml version="1.0"?>
_XML_
str << self.to_xml
end
def to_xml
str =<<-_XML_
<weblogUpdates version="#{@version}" updated="#{@updated}" count="#{@count}">
_XML_
@weblogs.each do |weblog|
str << weblog.to_xml
end
str << "</weblogUpdates>\n"
end
end
class Weblog
attr_accessor :name, :url, :when
def initialize(name=nil, url=nil, _when=nil)
@name = name
@url = url
@when = _when
end
def to_s
to_xml
end
def to_xml
<<-_XML_
<weblog name="#{@name}" url="#{@url}" when="#{@when}"/>
_XML_
end
end
end
# -- demo
if __FILE__ == $0
require 'time'
weblog_updates = WeblogUpdates::WeblogUpdates.load("changes.xml")
updated = Time.rfc822(weblog_updates.updated)
weblog_updates.each do |weblog|
date = updated - weblog.when
name = weblog.name
puts "#{date.strftime('%m/%d/%y %H:%M:%S')}\t#{name}"
end
end
make all-recursive make[1]: Entering directory `/var/tmp/portage/esehttpd-0.305/work/esehttpd-0.305' Making all in src make[2]: Entering directory `/var/tmp/portage/esehttpd-0.305/work/esehttpd-0.305/src' gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I/usr/local/include -I/usr/lib/ruby/1.8/i686-linux-gnu -I -march=athlon-xp -O3 -pipe -fomit-frame-pointer -Wall -DPREFIX=\"/usr\" -D_GNU_SOURCE -c accesslog.c gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I/usr/local/include -I/usr/lib/ruby/1.8/i686-linux-gnu -I -march=athlon-xp -O3 -pipe -fomit-frame-pointer -Wall -DPREFIX=\"/usr\" -D_GNU_SOURCE -c app.c gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I/usr/local/include -I/usr/lib/ruby/1.8/i686-linux-gnu -I -march=athlon-xp -O3 -pipe -fomit-frame-pointer -Wall -DPREFIX=\"/usr\" -D_GNU_SOURCE -c auth.c gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I/usr/local/include -I/usr/lib/ruby/1.8/i686-linux-gnu -I -march=athlon-xp -O3 -pipe -fomit-frame-pointer -Wall -DPREFIX=\"/usr\" -D_GNU_SOURCE -c base64.c gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I/usr/local/include -I/usr/lib/ruby/1.8/i686-linux-gnu -I -march=athlon-xp -O3 -pipe -fomit-frame-pointer -Wall -DPREFIX=\"/usr\" -D_GNU_SOURCE -c cgicommon.c gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I/usr/local/include -I/usr/lib/ruby/1.8/i686-linux-gnu -I -march=athlon-xp -O3 -pipe -fomit-frame-pointer -Wall -DPREFIX=\"/usr\" -D_GNU_SOURCE -c conf.c conf.c: In function `eh_config_filesmatch_delete': conf.c:60: warning: implicit declaration of function `regfree' conf.c: In function `eh_config_filesmatch_new': conf.c:77: warning: implicit declaration of function `regcomp' conf.c:77: `REG_EXTENDED' undeclared (first use in this function) conf.c:77: (Each undeclared identifier is reported only once conf.c:77: for each function it appears in.) conf.c:77: `REG_NOSUB' undeclared (first use in this function) conf.c:81: warning: implicit declaration of function `regerror' conf.c: In function `eh_config_dir_get_limit': conf.c:1139: warning: implicit declaration of function `regexec' make[2]: *** [conf.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory `/var/tmp/portage/esehttpd-0.305/work/esehttpd-0.305/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/esehttpd-0.305/work/esehttpd-0.305' make: *** [all-recursive-am] Error 2 !!! ERROR: net-www/esehttpd-0.305 failed. !!! Function src_compile, Line 28, Exitcode 2 !!! compilation failed追記: 0.308 でコンパイルできました
p2 と ● を使ったスレ立て荒らしが横行しているようですので、公開を停止しました。
$emerge -s abeni
Searching...
[ Results for search key : abeni ]
[ Applications found : 1 ]
* app-portage/abeni [ Masked ]
Latest version available: 0.0.9
Latest version installed: 0.0.9
Size of downloaded files: 129 kB
Homepage: http://abeni.sf.net/
Description: Integrated Development Environment for Gentoo Linux ebuilds
23日の夜10時頃、FINE/ISO400 で撮って 25% にリサイズです。
インターネットの掲示板に書き込みをした人の住所氏名の開示を、接続を中継したインターネットサービス会社に求めることが出来るかどうかが争われた訴訟で、東京地裁は17日、原告側の請求をほぼ認め、「DDIポケット」(東京都港区)に情報開示を命じた。井上哲男裁判長は「書き込みを中継しただけの接続業者(プロバイダー)でも、プロバイダー法の開示請求の対象になる」との初判断を示した。例によって 2ch 絡みの裁判ですね。ふと思ったのですが、プロバイダ責任法って電気通信事業法へのパッチなんですよねえ。マージしないのかしら。
$ab -c 100 -n 10000 localhost/index.html.ja.iso2022-jp
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.1 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software: Apache/2.0.47
Server Hostname: localhost
Server Port: 80
Document Path: /index.html.ja.iso2022-jp
Document Length: 1630 bytes
Concurrency Level: 100
Time taken for tests: 90.681102 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 19700000 bytes
HTML transferred: 16300000 bytes
Requests per second: 110.28 [#/sec] (mean)
Time per request: 906.811 [ms] (mean)
Time per request: 9.068 [ms] (mean, across all concurrent requests)
Transfer rate: 212.15 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 22 865 2150.0 314 10411
Waiting: 0 51 124.1 0 453
Total: 22 865 2150.0 314 10411
Percentage of the requests served within a certain time (ms)
50% 314
66% 388
75% 424
80% 440
90% 555
95% 10006
98% 10009
99% 10009
100% 10411 (longest request)
こちらは esehttpd です。高速。
$ab -c 100 -n 10000 localhost:18080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.1 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software:
Server Hostname: localhost
Server Port: 18080
Document Path: /
Document Length: 808 bytes
Concurrency Level: 100
Time taken for tests: 1.568942 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 9190000 bytes
HTML transferred: 8080000 bytes
Requests per second: 6373.72 [#/sec] (mean)
Time per request: 15.689 [ms] (mean)
Time per request: 0.157 [ms] (mean, across all concurrent requests)
Transfer rate: 5719.78 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 3 14 1.3 15 21
Waiting: 1 7 3.8 7 14
Total: 3 14 1.3 15 21
Percentage of the requests served within a certain time (ms)
50% 15
66% 15
75% 15
80% 15
90% 15
95% 15
98% 15
99% 15
100% 21 (longest request)
最近のコメント:
RSS
![]()
This work is licensed under a
Creative Commons License
(note: text only. w/o web design, citations, (re)distributed softwares).
_ 長谷部隼 あべし [タバコを吸う]
_ 僕ドラえもん [おいしい]