You are welcome! 

Yes, you are right.  One JVM instance is embed  per Nginx Worker process.  
The number of Nginx Workers  is generally the same with the number of CPU.

If one Worker crashs the Nginx Master will create a new one so you don't 
worry about JVM crashs accidentally.

Although there will be several JVM instances,  there 's only one main 
thread attached with the Nginx Woker process.

So the JVM instance uses less memory and no thread context switch cost in 
every JVM instance.

In some cases If you can  use only one JVM instance,  you can set the Nginx 
Worker number to be 1 and set jvm_workers > 1,  nginx-clojure will create 

a thread pool with fixed number of thread.

to handle requests for you.

On Tuesday, January 14, 2014 5:50:34 PM UTC+8, Feng Shen wrote:
>
> Hi, 
>
> Thanks for your work on nginx-clojure. It looks great!  
>
> As I know Nginx spawns many processes(correct me if I am wrong),  does 
> that mean, there will be many JVM process?
>
>
>
>
> On Tuesday, January 14, 2014 4:44:18 PM UTC+8, Xfeep Zhang wrote:
>>
>>
>> I have done the first one. The result is 
>> HERE<https://github.com/ptaoussanis/clojure-web-server-benchmarks>( 
>> https://github.com/ptaoussanis/clojure-web-server-benchmarks )
>> Thanks Taoussanis for his invitation to the project 
>> clojure-web-server-benchmarks<https://github.com/ptaoussanis/clojure-web-server-benchmarks>hosted
>>  on Github.
>>
>> On Tuesday, January 14, 2014 10:31:03 AM UTC+8, Xfeep Zhang wrote:
>>>
>>> You're welcome.
>>>
>>> I think there are several difficult phases :
>>>
>>> (1)  update the test program in 
>>> clojure-web-server-benchmarks<https://github.com/ptaoussanis/clojure-web-server-benchmarks>,
>>>  make the some packages to be the latest. (eg. http-kit from 1.3.0-alpha2 
>>> --> 2.1.16) and add nginx-php testing
>>> (2)  test about real world size contents by group eg. tiny, small, 
>>> medium, huge. 
>>> (3)  test about real world connection circumstances where a lot of 
>>> connection is inactive but keep open.
>>> (4)  try some real asynchronous test to fetch external resources (eg. 
>>> rest service , db) before response to the client. eg.  using 
>>> libdrizzle<https://launchpad.net/drizzle>a no-blocking mysql  client from  
>>> https://launchpad.net/drizzle
>>>
>>> On Tuesday, January 14, 2014 2:41:50 AM UTC+8, Sergey Didenko wrote:
>>>>
>>>> Looks very interesting, thank you for your work!
>>>>
>>>> I wonder how this is going to improve latency in comparison to nginx + 
>>>> http-kit for some real world test that is not using heavy DB operations.
>>>>
>>>>
>>>> On Mon, Jan 13, 2014 at 5:57 AM, Xfeep Zhang <easy...@163.com> wrote:
>>>>
>>>>>
>>>>> So far I have found why nginx-clojure is slower than http-kit when 
>>>>> 10000 concurrents. (when < = 1000 concurrents nginx-clojure is faster 
>>>>> than 
>>>>> http-kit.)
>>>>> I have set too many connections per nginx worker (worker_connections = 
>>>>> 20000) . This make nginx only use one worker to handle ab  requests 
>>>>> (every 
>>>>> request is tiny).
>>>>> I plan to take note of 
>>>>> c-erlang-java-performance<http://timyang.net/programming/c-erlang-java-performance/>and
>>>>>  fork 
>>>>> clojure-web-server-benchmarks<https://github.com/ptaoussanis/clojure-web-server-benchmarks>to
>>>>>   do some  real world tests.
>>>>>
>>>>>
>>>>>
>>>>> On Sunday, January 12, 2014 11:21:06 PM UTC+8, Xfeep Zhang wrote:
>>>>>>
>>>>>> Sorry for my mistake!
>>>>>>
>>>>>> 1. In the static file test, the ring-jetty result is about 10 
>>>>>> concurrents. NOT 10000 concurrents  ("Concurrency Level:      10" in  
>>>>>> the 
>>>>>> ab report ).
>>>>>> 2. In the small string test, All results about three server are about 
>>>>>> 10 concurrents. NOT 10000 concurrents.
>>>>>>
>>>>>> There are right results about these two mistake :
>>>>>>
>>>>>> 1. static file test
>>>>>>
>>>>>> (3) ring-jetty  more bad than 10 concurrents
>>>>>> ============================================================
>>>>>> ===========
>>>>>> Document Path:          /
>>>>>> Document Length:        29686 bytes
>>>>>>
>>>>>> *Concurrency Level:      10000*
>>>>>> Time taken for tests:   6.303 seconds
>>>>>> Complete requests:      100000
>>>>>> Failed requests:        0
>>>>>> Write errors:           0
>>>>>> Total transferred:      2982200000 bytes
>>>>>> HTML transferred:       2968600000 bytes
>>>>>> Requests per second:    15864.43 [#/sec] (mean)
>>>>>> Time per request:       630.341 [ms] (mean)
>>>>>> Time per request:       0.063 [ms] (mean, across all concurrent 
>>>>>> requests)
>>>>>> Transfer rate:          462020.65 [Kbytes/sec] received
>>>>>>
>>>>>> Connection Times (ms)
>>>>>>               min  mean[+/-sd] median   max
>>>>>> Connect:       12  328 535.0     43    3041
>>>>>> Processing:    25  124 112.9     96    3523
>>>>>> Waiting:        8   47  99.4     28    3523
>>>>>> Total:         52  452 544.5    157    4546
>>>>>>
>>>>>> Percentage of the requests served within a certain time (ms)
>>>>>>   50%    157
>>>>>>   66%    305
>>>>>>   75%   1071
>>>>>>   80%   1102
>>>>>>   90%   1139
>>>>>>   95%   1155
>>>>>>   98%   1462
>>>>>>   99%   3100
>>>>>>  100%   4546 (longest request)
>>>>>>
>>>>>>
>>>>>> 2. simple string (10000 concurrents)
>>>>>>
>>>>>> http-kit is the fastest.  But nginx-clojure is too young and has vast 
>>>>>> room for growth :)
>>>>>>
>>>>>> (1) nginx-clojure-0.1.0
>>>>>>
>>>>>> Document Path:          /
>>>>>> Document Length:        15 bytes
>>>>>>
>>>>>> *Concurrency Level:      10000*
>>>>>> Time taken for tests:   2.834 seconds
>>>>>> Complete requests:      100000
>>>>>> Failed requests:        0
>>>>>> Write errors:           0
>>>>>> Total transferred:      17000000 bytes
>>>>>> HTML transferred:       1500000 bytes
>>>>>> Requests per second:    35291.16 [#/sec] (mean)
>>>>>> Time per request:       283.357 [ms] (mean)
>>>>>> Time per request:       0.028 [ms] (mean, across all concurrent 
>>>>>> requests)
>>>>>> Transfer rate:          5858.88 [Kbytes/sec] received
>>>>>>
>>>>>> Connection Times (ms)
>>>>>>               min  mean[+/-sd] median   max
>>>>>> Connect:       51  118  21.6    118     178
>>>>>> Processing:    73  150  33.8    146     263
>>>>>> Waiting:       42  110  32.0    104     246
>>>>>> Total:        177  268  25.6    269     327
>>>>>>
>>>>>> Percentage of the requests served within a certain time (ms)
>>>>>>   50%    269
>>>>>>   66%    278
>>>>>>   75%    285
>>>>>>   80%    288
>>>>>>   90%    297
>>>>>>   95%    309
>>>>>>   98%    314
>>>>>>   99%    318
>>>>>>  100%    327 (longest request)
>>>>>>
>>>>>>
>>>>>> (2) http-kit 2.1.16
>>>>>>
>>>>>> Document Path:          /
>>>>>> Document Length:        15 bytes
>>>>>>
>>>>>> *Concurrency Level:      10000*
>>>>>> Time taken for tests:   2.691 seconds
>>>>>> Complete requests:      100000
>>>>>> Failed requests:        0
>>>>>> Write errors:           0
>>>>>> Total transferred:      13400000 bytes
>>>>>> HTML transferred:       1500000 bytes
>>>>>> Requests per second:    37165.27 [#/sec] (mean)
>>>>>> Time per request:       269.068 [ms] (mean)
>>>>>> Time per request:       0.027 [ms] (mean, across all concurrent 
>>>>>> requests)
>>>>>> Transfer rate:          4863.42 [Kbytes/sec] received
>>>>>>
>>>>>> Connection Times (ms)
>>>>>>               min  mean[+/-sd] median   max
>>>>>> Connect:       72  118  46.2    114    1094
>>>>>> Processing:    31  134  26.1    136     344
>>>>>> Waiting:       21   81  33.5     71     273
>>>>>> Total:        183  252  43.8    251    1435
>>>>>>
>>>>>> Percentage of the requests served within a certain time (ms)
>>>>>>   50%    251
>>>>>>   66%    258
>>>>>>   75%    259
>>>>>>   80%    261
>>>>>>   90%    263
>>>>>>   95%    263
>>>>>>   98%    265
>>>>>>   99%    266
>>>>>>  100%   1435 (longest request)
>>>>>>
>>>>>>
>>>>>>
>>>>>> (3) ring-jetty
>>>>>>
>>>>>> Document Path:          /
>>>>>> Document Length:        15 bytes
>>>>>>
>>>>>> *Concurrency Level:      10000*
>>>>>> Time taken for tests:   9.740 seconds
>>>>>> Complete requests:      100000
>>>>>> Failed requests:        0
>>>>>> Write errors:           0
>>>>>> Total transferred:      16700000 bytes
>>>>>> HTML transferred:       1500000 bytes
>>>>>> Requests per second:    10267.16 [#/sec] (mean)
>>>>>> Time per request:       973.979 [ms] (mean)
>>>>>> Time per request:       0.097 [ms] (mean, across all concurrent 
>>>>>> requests)
>>>>>> Transfer rate:          1674.43 [Kbytes/sec] received
>>>>>>
>>>>>> Connection Times (ms)
>>>>>>               min  mean[+/-sd] median   max
>>>>>> Connect:        0  193 399.8     11    3006
>>>>>> Processing:     0   51 207.6      5    7050
>>>>>> Waiting:        0   39 204.5      4    7050
>>>>>> Total:          0  244 482.0     28    8080
>>>>>>
>>>>>> Percentage of the requests served within a certain time (ms)
>>>>>>   50%     28
>>>>>>   66%     79
>>>>>>   75%    283
>>>>>>   80%    306
>>>>>>   90%   1009
>>>>>>   95%   1067
>>>>>>   98%   1283
>>>>>>   99%   1886
>>>>>>  100%   8080 (longest request)
>>>>>>
>>>>>>
>>>>>> On Friday, January 10, 2014 8:23:02 AM UTC+8, Julien wrote:
>>>>>>>
>>>>>>> Impressive!
>>>>>>> Did you run some benchmark? How does it compare to ring-jetty and 
>>>>>>> http-kit?
>>>>>>>
>>>>>>> Julien
>>>>>>>
>>>>>>> Le jeudi 9 janvier 2014 12:42:31 UTC-3, Xfeep Zhang a écrit :
>>>>>>>>
>>>>>>>> [image: Alt 
>>>>>>>> text]<https://github.com/xfeep/nginx-clojure/blob/master/logo.png>Nginx-Clojure
>>>>>>>>  
>>>>>>>> is a Nginx <http://nginx.org/> module for embedding Clojure or 
>>>>>>>> Java programs, typically those 
>>>>>>>> Ring<https://github.com/ring-clojure/ring/blob/master/SPEC>based 
>>>>>>>> handlers.
>>>>>>>>
>>>>>>>> There are some core features :
>>>>>>>>
>>>>>>>>    1. Compatible with 
>>>>>>>> Ring<https://github.com/ring-clojure/ring/blob/master/SPEC>and 
>>>>>>>> obviously supports those Ring based frameworks, such as Compojure etc.
>>>>>>>>    2. One of benifits of Nginx <http://nginx.org/> is worker 
>>>>>>>>    processes are automatically restarted by a master process if they 
>>>>>>>> crash 
>>>>>>>>    3. Utilizes lazy headers and direct memory operation between 
>>>>>>>>    Nginx <http://nginx.org/> and JVM to fast handle dynamic 
>>>>>>>>    contents from Clojure or Java code.
>>>>>>>>    4. Utilizes Nginx <http://nginx.org/> zero copy file sending 
>>>>>>>>    mechanism to fast handle static contents controlled by Clojure or 
>>>>>>>> Java code. 
>>>>>>>>    5. 
>>>>>>>>    
>>>>>>>>    Supports Linux x64, Win32 and Mac OS X
>>>>>>>>    
>>>>>>>>
>>>>>>>> Use Nginx-Clojure, you can deploy clojure web app on Nginx without 
>>>>>>>> any Java web server.  For more detials please check Nginx-Clojure 
>>>>>>>> github site <https://github.com/xfeep/nginx-clojure>. 
>>>>>>>>
>>>>>>>>
>>>>>>>>  -- 
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Clojure" group.
>>>>> To post to this group, send email to clo...@googlegroups.com
>>>>> Note that posts from new members are moderated - please be patient 
>>>>> with your first post.
>>>>> To unsubscribe from this group, send email to
>>>>> clojure+u...@googlegroups.com
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/clojure?hl=en
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Clojure" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to clojure+u...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>
>>>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to