Skip to content

Instantly share code, notes, and snippets.

View matsumotory's full-sized avatar
:octocat:
manager now

Ryosuke Matsumoto / @matsumotory matsumotory

:octocat:
manager now
View GitHub Profile

10msec程度のレスポンスタイムのURLを作る

worker_processes  1;
events {
    worker_connections  1024;
}

daemon off;
master_process off;
    server {
        listen       48080;
        server_name  localhost;
        root /home/ubuntu/DEV/ngx_mruby/build/nginx/html/;

        # test for hello world and cache option
        location /mruby {
            mruby_rewrite_handler_code 'Nginx::Async.sleep 3000; Nginx.echo "done"';
        }
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index ecc6599..1c60951 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -115,6 +115,13 @@ int compel_interrupt_task(int pid)
{
int ret;
+ ret = ptrace(PTRACE_DETACH, pid, NULL,0);
+ if (ret) {
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index ecc6599..1c60951 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -115,6 +115,13 @@ int compel_interrupt_task(int pid)
{
int ret;
+ ret = ptrace(PTRACE_DETACH, pid, NULL,0);
+ if (ret) {

async sleepの実装と既存のテストを全て通せた

従来のsleep

worker_processes  1;
events {
    worker_connections  200;
}
def _ngx_mruby_prepare_fiber(app_proc)
    p "call _ngx_mruby_prepare_fiber"
    fiber = Fiber.new do
      p "call fiber"
      app_proc.call
      p "done fiber"
    end

 Proc.new do
# $ ulimit -n 60000

worker_processes  1;

events {
    worker_connections  30000;
}

daemon off;
  server {
      mruby_stream_server_context_code '
        (13000..18000).each { |port| Nginx::Stream.add_listener({address: port.to_s}) }
      ';
      proxy_pass static_server0;
  }
#!/usr/bin/env ruby
# Sat May 27 17:56:34 2017 1495875394 0 773 773 772
# Sat May 27 17:56:39 2017 1495875399 0 773 773 765
# Sat May 27 17:56:18 2017 1495875378 0 773 773 771
# Sat May 27 17:56:19 2017 1495875379 0 774 774 771
# Sat May 27 17:56:19 2017 1495875379 0 774 774 770
# Sat May 27 17:56:19 2017 1495875379 0 774 774 772
smooth_data = []
729 3452350 0.9 3.2 3207592 3176128 ? Ss 17:29 0:00 nginx: master process ./build/nginx/sbin/nginx
729 3452351 0.0 3.2 3207592 3175912 ? S 17:29 0:00 \_ nginx: worker process
729 3452352 0.0 3.2 3207592 3175912 ? S 17:29 0:00 \_ nginx: worker process
729 3452353 0.0 3.2 3207592 3175912 ? S 17:29 0:00 \_ nginx: worker process
729 3452354 0.0 3.2 3207592 3175912 ? S 17:29 0:00 \_ nginx: worker process