Re: [nginx-clojure] Getting started question

2014-07-13 Thread Xfeep Zhang
Hi Boris

If there 's no port conflict, you can run multiple nginx instances without 
any problem. So if you do installation by binary you needn't remove the 
prior version.
If you don't want to run multiple nginx instances , you can stop the old 
one and copy the configuration files to the new one related directories. 
Then do additional 
configurations for nginx-clojure module, start the new nginx instance 
(including nginx-clojure).

If you want to replace the old nginx, you need to some things  to keep the 
default behaviors the same with you old nginx.

(1) Get the build configure arguments with your old nginx  you can run 

nginx -V
(2) Get the nginx souce and nginx-clojure source
(3) rebuild nginx-clojure with not only the build configure arguments with 
your old nginx but also the build configure arguments with nginx-clojure. 
e.g.

$./configure MY-OLD-BUILD-CONFIGURE-ARGUMENTS\
--add-module=nginx-clojure/src/c
$make

(4) replace the old nginx binary file with the new one.

regards
xfeep




On Wednesday, July 9, 2014 4:24:02 AM UTC+8, Boris Kourtoukov wrote:

 I am working on a small personal project and want to use/learn nginx and 
 clojure as the web backend. Unfortunately I am bogged down my the 
 installation instructions.

 I have Nginx running and serving html on a Linode instance, I just don't 
 know enough about it's plugins to do step 1.1 Installation by Binary  in 
 the nginx-clojure instructions: 
 https://github.com/nginx-clojure/nginx-clojure#11-installation-by-binary

 The way I read it nginx-clojure is meant to completely replace nginx on 
 the machine? So should I remove the prior version, install this from binary 
 and then re-setup the served sites? 

 Thanks and sorry for the basic question,
 Boris


-- 
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/d/optout.


[ANN] Nginx-Clojure v0.2.3 released

2014-07-05 Thread Xfeep Zhang
Nginx-Clojure https://github.com/nginx-clojure/nginx-clojure is a Nginx 
module for embedding Clojure or Java programs, typically those Ring based 
handlers.

Release 0.2.3 contains four important updates


   1. Fix issue - After invoking on coroutine based socket nginx worker 
   will exit and be recreated when network is disabled (issue #26)
   2. Fix issue - PATCH loses the data payload (issue #27)
   3. Support user defined http request method (issue #28 )
   4. Fix issue - Nginx worker crashes when to fetch http header 
   authorization from request (issue #30)
   


The binary release (support win32, linux x86 32bit, linux x64, macosx) can 
be found from https://sourceforge.net/projects/nginx-clojure/files/
The source files and guide can be found from 
https://github.com/nginx-clojure/nginx-clojure/blob/master/README.md
The index page for guide can be found from 
https://github.com/nginx-clojure/nginx-clojure/wiki

There are some core features of Nginx-Clojure:


   1. Compatible with Ring and obviously supports those Ring based 
   frameworks, such as Compojure etc.
   2. Use Java/Clojure code to write a simple nginx rewrite handler to set 
   var before proxy pass
   3. Non-blocking coroutine based socket which is Compatible with Java 
   Socket API and works well with largely existing java library such as apache 
   http client, mysql jdbc drivers. With this feature one java main thread can 
   handle thousands of connections.
   4. Handle multiple sockets parallel in sub coroutines, e.g. we can 
   invoke two remote services at the same time feature
   5. Asynchronous callback API of socket for some advanced usage
   6. Run initialization clojure code when nginx worker starting
   7. Support user defined http request method
   8. Compatible with the Nginx lastest stable version 1.6.0. (Nginx 1.4.x 
   is also ok, older version is not tested and maybe works.)
   9. One of benifits of Nginx is worker processes are automatically 
   restarted by a master process if they crash
   10. Utilizes lazy headers and direct memory operation between Nginx and 
   JVM to fast handle dynamic contents from Clojure or Java code.
   11. Utilizes Nginx zero copy file sending mechanism to fast handle 
   static contents controlled by Clojure or Java code.
   12. Supports Linux x64, Linux x86 32bit, Win32 and Mac OS X. Win64 users 
   can also run it with a 32bit JRE/JDK.
   

-- 
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/d/optout.


Re: [ANN] Nginx-Clojure v0.2.2 released

2014-06-03 Thread Xfeep Zhang
The multiprocess from nginx is quite different with some old server
implementations. Within nginx one process can  handle thousands of
connections at the same time. But some old server implementations are one
process per request.

If your http service is stateless, multiprocess or single process is not
important. If your http service should rely on some state store such as
session store, with nginx-clojure you have three choices :


   1. Encrypted Cookie store
   2. SharedHashMap
   https://github.com/OpenHFT/HugeCollections/wiki/Getting-Started to
   share data among nginx worker processes
   3. Remote Session Store such as Redis, MemCached etc.




On Mon, Jun 2, 2014 at 5:22 PM, Toni Helenius ton...@gmail.com wrote:

 Out of interest, how do people use these multiprocess server thingies like
 nginx-clojure or vert.x with datomic?


 On Saturday, May 31, 2014 7:57:54 PM UTC+3, Xfeep Zhang wrote:

 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.

 Release 0.2.2 contains two updates

 1. Fix bug of with Compojure 1.1.5 + Apache Solrj 4.3.0 + httpclient
 4.3.2 NPE happens first time then everything is OK (issue #22)
 2. Verifying option for auto generated waving configurations needed by
 coroutine based socket (issue #23)


 The binary release can be found from https://sourceforge.net/
 projects/nginx-clojure/files/
 The source files and guide can be found from https://github.com/nginx-
 clojure/nginx-clojure/blob/master/README.md
 The index page for guide can be found from https://github.com/nginx-
 clojure/nginx-clojure/wiki

 There are some core features of Nginx-Clojure:

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. Use Java/Clojure code to write a simple nginx rewrite handler to
set var before proxy pass
3. Non-blocking coroutine based socket which is Compatible with Java
Socket API and works well with largely existing java library such as 
 apache
http client, mysql jdbc drivers. With this feature one java main thread 
 can
handle thousands of connections.
4. Handle multiple sockets parallel in sub coroutines, e.g. we can
invoke two remote services at the same time feature
5. Asynchronous callback API of socket for some advanced usage
6. Run initialization clojure code when nginx worker starting
7. Compatible with the Nginx lastest stable version 1.6.0. (Nginx
1.4.x is also ok, older version is not tested and maybe works.)
8. One of benifits of Nginx http://nginx.org/ is worker processes
are automatically restarted by a master process if they crash
9. Utilizes lazy headers and direct memory operation between Nginx
http://nginx.org/ and JVM to fast handle dynamic contents from
Clojure or Java code.
10. Utilizes Nginx http://nginx.org/ zero copy file sending
mechanism to fast handle static contents controlled by Clojure or Java 
 code.
11. Supports Linux x64, Linux x86 32bit, Win32 and Mac OS X. Win64
users can also run it with a 32bit JRE/JDK.

  --
 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 a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/-mianyasT5o/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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/d/optout.


Re: [ANN] Nginx-Clojure v0.2.2 released

2014-06-03 Thread Xfeep Zhang
Further more  if you use  Encrypted Cookie store Or Remote Session Store to
manage your state,
your http service will become more lightweight and can be easily expanded
horizontally, e.g. you can add more computers to host nginx-clojure to run
your http service and let one computer with nginx or LVS or haproxy as the
front.



On Tue, Jun 3, 2014 at 11:52 PM, Xfeep Zhang xfe...@gmail.com wrote:

 The multiprocess from nginx is quite different with some old server
 implementations. Within nginx one process can  handle thousands of
 connections at the same time. But some old server implementations are one
 process per request.

 If your http service is stateless, multiprocess or single process is not
 important. If your http service should rely on some state store such as
 session store, with nginx-clojure you have three choices :


1. Encrypted Cookie store
2. SharedHashMap
https://github.com/OpenHFT/HugeCollections/wiki/Getting-Started to
share data among nginx worker processes
3. Remote Session Store such as Redis, MemCached etc.




 On Mon, Jun 2, 2014 at 5:22 PM, Toni Helenius ton...@gmail.com wrote:

 Out of interest, how do people use these multiprocess server thingies
 like nginx-clojure or vert.x with datomic?


 On Saturday, May 31, 2014 7:57:54 PM UTC+3, Xfeep Zhang wrote:

 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.

 Release 0.2.2 contains two updates

 1. Fix bug of with Compojure 1.1.5 + Apache Solrj 4.3.0 + httpclient
 4.3.2 NPE happens first time then everything is OK (issue #22)
 2. Verifying option for auto generated waving configurations needed by
 coroutine based socket (issue #23)


 The binary release can be found from https://sourceforge.net/
 projects/nginx-clojure/files/
 The source files and guide can be found from https://github.com/nginx-
 clojure/nginx-clojure/blob/master/README.md
 The index page for guide can be found from https://github.com/nginx-
 clojure/nginx-clojure/wiki

 There are some core features of Nginx-Clojure:

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. Use Java/Clojure code to write a simple nginx rewrite handler to
set var before proxy pass
3. Non-blocking coroutine based socket which is Compatible with Java
Socket API and works well with largely existing java library such as 
 apache
http client, mysql jdbc drivers. With this feature one java main thread 
 can
handle thousands of connections.
4. Handle multiple sockets parallel in sub coroutines, e.g. we can
invoke two remote services at the same time feature
5. Asynchronous callback API of socket for some advanced usage
6. Run initialization clojure code when nginx worker starting
7. Compatible with the Nginx lastest stable version 1.6.0. (Nginx
1.4.x is also ok, older version is not tested and maybe works.)
8. One of benifits of Nginx http://nginx.org/ is worker processes
are automatically restarted by a master process if they crash
9. Utilizes lazy headers and direct memory operation between Nginx
http://nginx.org/ and JVM to fast handle dynamic contents from
Clojure or Java code.
10. Utilizes Nginx http://nginx.org/ zero copy file sending
mechanism to fast handle static contents controlled by Clojure or Java 
 code.
11. Supports Linux x64, Linux x86 32bit, Win32 and Mac OS X. Win64
users can also run it with a 32bit JRE/JDK.

  --
 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 a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/-mianyasT5o/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
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

[ANN] Nginx-Clojure v0.2.1 released

2014-05-16 Thread Xfeep Zhang

Nginx-Clojure is a Nginx http://nginx.org/ module for embedding Clojure 
or Java programs, typically those 
Ringhttps://github.com/ring-clojure/ring/blob/master/SPEC based 
handlers.
The release v0.2.1 has these new features:

   1. Support to close coroutine based socket from non-main thread (issue 
   #19)
   2. Auto generated waving class configurations about Proxy 
   InvocationHandler instance (issue #17 )
   3. Support auto turn on thread pool mode when turning on Run Tool Mode 
   feature (issue #16 )
   4. Fix bug of reading from coroutine based socket inputstream returns 0 
   when eof, should return -1 (issue #15)
   5. Handle multiple sockets parallel in sub coroutines, e.g. we can 
   invoke two remote services at the same time feature (issue #14)
   6. Support nginx rewrite handler to set var before proxy pass (issue #3)
   
More detail please check the Nginx-Clojure github site :

https://github.com/nginx-clojure/nginx-clojure/blob/master/README.md



-- 
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/d/optout.


Re: difference in behavior for :let modifiers in for vs. doseq

2014-05-03 Thread Xfeep Zhang
user (for [ b '(1 2 3) :let [a 1] ] (println a b))

is OK.

On Thursday, May 1, 2014 12:39:22 PM UTC+8, Yuri Niyazov wrote:

 Hello everyone, 

   In Clojure 1.6:

 user (doseq [:let [a 1] b '(1 2 3)] (println a b))
 1 1
 1 2
 1 3
 nil
 user (for [:let [a 1] b '(1 2 3)] (println a b))
 IllegalStateException Can't pop empty vector 
  clojure.lang.PersistentVector.pop (PersistentVector.java:381)
 user 

 Is this expected behavior? a bug? Something I missed in the documentation?


-- 
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/d/optout.


Re: [ANN] nginx-clojure v0.2.0 -- Let MySQL JDBC Driver Apache HttpClient Fly With Epoll/Kqueue on Nginx

2014-04-30 Thread Xfeep Zhang
Thank you. It's my honour that nginx-clojure will  being used possibly.
As you said, coroutine based Java socket implementation can simplify 
asynchronous event model. 
We just write synchronous style code about java socket API and get the 
non-blocking and event driven executing on nginx.



On Tuesday, April 29, 2014 10:20:53 PM UTC+8, Rick Richardson wrote:

 This is excellent!  I definitely think there is a lot of opportunity for 
 fusion between Clojure and Nginx.  Clojure's model already supports the 
 cooperating threads model that can simplify Nginx's complex event model, as 
 you have demonstrated.  Work has already been done that proves this idea 
 can result in productivity and scale gains (nginx + Lua)  It can also 
 greatly simplify architectures by cutting out load-balancers making less to 
 patch for security/stability issues.   I look forward to using this on my 
 upcoming web projects. 


 On Friday, April 25, 2014 11:51:41 PM UTC-4, Xfeep Zhang wrote:

 nginx-clojure v0.2.0 includes new features:


1. non-blocking socket based on coroutine and compatible with largely 
existing java library such as apache http client, mysql jdbc drivers
2. asynchronous callback API of socket for some advanced usage
3. run initialization clojure code when nginx worker starting
4. provide a build-in tool to make setting of coroutine based socket 
easier
5. support Linux 32bit x86 now
6. publish [binary release compiled with lastes stable nginx 1.6.0](
https://sourceforge.net/projects/nginx-clojure/files/) about Linux 
x64, Linux i586, Win32  MacOS X.


 If the http service should do some slow I/O operations such as access 
 external http service, database, etc.  nginx worker will be blocked by 
 those operations 
 and the new  user  request even static file request will be blocked. It 
 really sucks! Before v0.2.0 the only choice is using thread pool but now we 
 have 
 three choice  Now:

1. Coroutine based Socket -- Let MySQL JDBC Driver  Apache 
HttpClient Fly With Epoll/Kqueue on  Nginx
- Java Socket API Compatible and work well with largely existing java 
   library such as apache http client, mysql jdbc drivers etc.
   - non-blocking, cheap, fast and let one java main thread be able 
   to handle thousands of connections.
   - Your old code **_need not be changed_** and those plain and old 
   java socket based code such as Apache Http Client, MySQL mysql jdbc 
 drivers 
   etc. will be on the fly with epoll/kqueue on Linux/BSD!
   - You must do some steps to get the right class waving 
   configuration file and set it in the nginx conf file.
2. Asynchronous Socket
   - More details here: https://github.com/nginx-clojure/nginx-clojure
   3. Thread Pool
- More details here : https://github.com/nginx-clojure/nginx-clojure
   

 More details please visit nginx-clojure github site : 
 https://github.com/nginx-clojure/nginx-clojure



-- 
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/d/optout.


[ANN] nginx-clojure v0.2.0 -- Let MySQL JDBC Driver Apache HttpClient Fly With Epoll/Kqueue on Nginx

2014-04-25 Thread Xfeep Zhang
nginx-clojure v0.2.0 includes new features:


   1. non-blocking socket based on coroutine and compatible with largely 
   existing java library such as apache http client, mysql jdbc drivers
   2. asynchronous callback API of socket for some advanced usage
   3. run initialization clojure code when nginx worker starting
   4. provide a build-in tool to make setting of coroutine based socket 
   easier
   5. support Linux 32bit x86 now
   6. publish [binary release compiled with lastes stable nginx 
   1.6.0](https://sourceforge.net/projects/nginx-clojure/files/) about Linux 
   x64, Linux i586, Win32  MacOS X.
   

If the http service should do some slow I/O operations such as access 
external http service, database, etc.  nginx worker will be blocked by 
those operations 
and the new  user  request even static file request will be blocked. It 
really sucks! Before v0.2.0 the only choice is using thread pool but now we 
have 
three choice  Now:

   1. Coroutine based Socket -- Let MySQL JDBC Driver  Apache HttpClient 
   Fly With Epoll/Kqueue on  Nginx
   - Java Socket API Compatible and work well with largely existing java 
  library such as apache http client, mysql jdbc drivers etc.
  - non-blocking, cheap, fast and let one java main thread be able to 
  handle thousands of connections.
  - Your old code **_need not be changed_** and those plain and old 
  java socket based code such as Apache Http Client, MySQL mysql jdbc 
drivers 
  etc. will be on the fly with epoll/kqueue on Linux/BSD!
  - You must do some steps to get the right class waving configuration 
  file and set it in the nginx conf file.
   2. Asynchronous Socket
  - More details here: https://github.com/nginx-clojure/nginx-clojure
  3. Thread Pool
   - More details here : https://github.com/nginx-clojure/nginx-clojure
  

More details please visit nginx-clojure github site : 
https://github.com/nginx-clojure/nginx-clojure

-- 
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/d/optout.


Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-21 Thread Xfeep Zhang

On Tuesday, January 21, 2014 6:25:02 AM UTC+8, Sergey Didenko wrote:

 Hi Xfeep,

 What are the good ways to handle some heavy Clojure calculations when 
 using nginx-clojure?


Do you mean every request will cost too much time ?  If time cost is mainly 
caused by IO blocking,  java thread pool can be used to resolve this 
problem. 

Otherwise you must add more  computers or use more fast hardware to handle 
those pure  CPU concentrated tasks.
 

 Under nginx model it's bad to block other incoming requests by holding a 
 working thread for too long, right?


Yes. Typically  the nginx worker processes won't be too many  and maybe the 
same number of your cpu cores. 
If you can not reduce single reponse time,  all worker will be blocked by 
those slow tasks.


 So is it better to route complex job to http-kit? Or to use some kind of 
 queue? Or may be to use this nginx-clojure JVM pool that is off by default?



Suppose your time cost is mainly caused by IO blocking, java thread pool  
can be used by two ways :

(1)  use *pcall* , *pvalue* etc. provided by clojure to execute your tasks 
parallel  to reduce single request-response time.
OR
(2)  with nginx-clojure just simply set jvm_workers to some medium  number 
eg 100, or bigger number if you get more memory. This thread pool will make 
nginx workers not blocked until all threads are exhausted.

When jvm_workers  0,  there's additional cost to one transfer  event flag  
by  pipe. But this cost can be ignored for your slow response and this cost 
will be lower than using nginx as a proxy to  pass requests to backend java 
server.

In the future release of Nginx-Clojure,  synchronized non-blocking IO APIs  
will be provided.  I think those synchronized non-blocking APIs will 
simpilfy to handle some IO blocked tasks.

By that time jvm_workers maybe no need to be  0 .
 


 On Wed, Jan 15, 2014 at 3:18 PM, Xfeep Zhang easy...@163.comjavascript:
  wrote:



 On Wednesday, January 15, 2014 12:39:57 PM UTC+8, Roberto De Ioris wrote:


 i strongly suggest you to avoid the performance as a selling point, 
 your 
 project is cool but not for performance (and you are using a pipe to 
 transfer requests data from nginx to the jvm so there ipc in place too, 
 even if you can improve things using OS-specific syscall like splice). 

  
 Although I have make it clear in the nginx english mail list,  people 
 joined clojure group may still misunderstand.

 So please forgive me repeating the message here.

 In the nginx english mail list , I have said :

  With the default setting pipe is not used.

 Pipe is only used for enable jvm thread pool mode only when jvm_workers  
 0 (jvm_workers default = 0).

 Further more pipe is never used to transfer the whole request or response 
 message.

 When under jvm thread pool mode, pipe is only used to transfer a event 
 flag (only one pointer size)。
  


 -- 
 Roberto De Ioris 
 http://unbit.it 

  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 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 javascript:.
 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.


Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-15 Thread Xfeep Zhang
On Wednesday, January 15, 2014 12:39:57 PM UTC+8, Roberto De Ioris wrote:


  Hi Mingli, 
  
  Thanks for  your suggestion. 
  
  Nginx-Clojure is quite different from uwsgi when supports JVM. 
  
  Nginx-Clojure make JVM embed into Nginx worker process. JVM and Nginx 
  worker have  the same memory process space. 
  
   Nginx-Clojure heavy uses pointer operation just like C to handle memory 
  with Nginx worker. 
  
   If I'm not wrong,  uwsgi create every process for every request, or 
  shared 
  JVM processes between request? 

 uWSGI creates a pool of processes with a number of threads in each and 
 then they are used for the whole server life cycle. (a pretty standard 
 behaviour) 


  
  When using Nginx-Clojure there's no IPC cost  even no thread switch cost 
  if 
  jvm_workers = 0 which is default. 
  
  So it's why Nginx-Clojure is so fast! 
  

 i strongly suggest you to avoid the performance as a selling point, your 
 project is cool but not for performance (and you are using a pipe to 
 transfer requests data from nginx to the jvm so there ipc in place too, 
 even if you can improve things using OS-specific syscall like splice). 

 It is cool because it simplify deployments, but nginx is not an 
 application server, so things like multi-strategy gracefully reloads, 
 stuck-requests managers, offloading and so on are not available. 


Nginx is not an  application server, but it can be a good application with 
some module such as nginx-lua which largely used in  production.


 Regarding the ipc problem, you generally put a load balancer on front of 
 your app, so there is always ipc 


If we use F5 or LVS(Linux Virtual Server) as a balancer there 's no IPC :)
 

 Do not get me wrong, as i have already said your project is cool, but you 
 should focus not on performance but on better integration with the nginx 
 api for writing non-blocking apps (if possible), something at uWSGI 
 unfortunately failed (the JVM has no support for switching stacks out of 
 the box, something that is required for async mode in uWSGI) 


Thank you very much! Really good advices ! :) 

-- 
-- 
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.


Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-15 Thread Xfeep Zhang


On Wednesday, January 15, 2014 12:39:57 PM UTC+8, Roberto De Ioris wrote:


 i strongly suggest you to avoid the performance as a selling point, your 
 project is cool but not for performance (and you are using a pipe to 
 transfer requests data from nginx to the jvm so there ipc in place too, 
 even if you can improve things using OS-specific syscall like splice). 

 
Although I have make it clear in the nginx english mail list,  people 
joined clojure group may still misunderstand.

So please forgive me repeating the message here.

In the nginx english mail list , I have said :

 With the default setting pipe is not used.

Pipe is only used for enable jvm thread pool mode only when jvm_workers  0 
(jvm_workers default = 0).

Further more pipe is never used to transfer the whole request or response 
message.

When under jvm thread pool mode, pipe is only used to transfer a event flag 
(only one pointer size)。
 


 -- 
 Roberto De Ioris 
 http://unbit.it 


-- 
-- 
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.


Re: Clojure web server benchmarks

2014-01-14 Thread Xfeep Zhang
I have committed some update.


   - org.clojure/clojure 1.4.0 -- 1.5.1
   - compojure 1.1.4 -- 1.1.6
   - ring 1.1.6 -- 1.2.1
   - aleph 0.3.0-beta13 -- 0.3.0
   - http-kit 1.3.0-alpha2 -- 2.1.16
   - ring-netty-adapter 0.0.3 -- netty-ring-adapter 0.4.6
   - remove testing about pure nginx which generally dosen't service 
   dymanic contents without other modules. 
   - add nginx with php5-fpm 5.5 testing
   - add nginx-clojure 0.1.0 testing
   - add 128 clients testing

Cheers :-)


On Monday, January 13, 2014 3:13:34 PM UTC+8, Peter Taoussanis wrote:

 You are welcome.
 My Github user name is xfeep. 
 I'm glad to join the repo. Thanks for your invitation!


 Okay, great - I have added you. You can make any changes you like. I would 
 be happy if you or someone else wants to maintain (update) the repo.

 Cheers :-)

 -- 
 *Peter Taoussanis*
  

-- 
-- 
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.


Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-14 Thread Xfeep Zhang

I have done the first one. The result is 
HEREhttps://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-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarkshosted
 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-benchmarkshttps://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 
 libdrizzlehttps://launchpad.net/drizzlea 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 1 
 concurrents. (when  = 1000 concurrents nginx-clojure is faster than 
 http-kit.)
 I have set too many connections per nginx worker (worker_connections = 
 2) . This make nginx only use one worker to handle ab  requests (every 
 request is tiny).
 I plan to take note of 
 c-erlang-java-performancehttp://timyang.net/programming/c-erlang-java-performance/and
  fork 
 clojure-web-server-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarksto
   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 1 concurrents  (Concurrency Level:  10 in  the 
 ab report ).
 2. In the small string test, All results about three server are about 
 10 concurrents. NOT 1 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:  1*
 Time taken for tests:   6.303 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  298220 bytes
 HTML transferred:   296860 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 433041
 Processing:25  124 112.9 963523
 Waiting:8   47  99.4 283523
 Total: 52  452 544.51574546

 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 (1 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:  1*
 Time taken for tests:   2.834 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  1700 bytes
 HTML transferred:   150 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.6118 178
 Processing:73  150  33.8146 263
 Waiting:   42  110  32.0104 246
 Total:177  268  25.6269 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:  1*
 Time taken for tests:   2.691 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total

Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-14 Thread Xfeep Zhang
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 
 HEREhttps://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-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarkshosted
  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-benchmarkshttps://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 
 libdrizzlehttps://launchpad.net/drizzlea 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 
 1 concurrents. (when  = 1000 concurrents nginx-clojure is faster 
 than 
 http-kit.)
 I have set too many connections per nginx worker (worker_connections = 
 2) . This make nginx only use one worker to handle ab  requests 
 (every 
 request is tiny).
 I plan to take note of 
 c-erlang-java-performancehttp://timyang.net/programming/c-erlang-java-performance/and
  fork 
 clojure-web-server-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarksto
   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 1 concurrents  (Concurrency Level:  10 in  
 the 
 ab report ).
 2. In the small string test, All results about three server are about 
 10 concurrents. NOT 1 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:  1*
 Time taken for tests:   6.303 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  298220 bytes
 HTML transferred:   296860 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 433041
 Processing:25  124 112.9 963523
 Waiting:8   47  99.4 283523
 Total: 52  452 544.51574546

 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 (1 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:  1*
 Time taken for tests:   2.834 seconds
 Complete requests:  10
 Failed requests

Re: Clojure web server benchmarks

2014-01-14 Thread Xfeep Zhang
You 're right!

ab has many limitations.

Maybe httpload , wrk, Weighttp or ABs  ( several instances of AB)  are 
better when test client and server do not run on the same computer.

On Tuesday, January 14, 2014 5:52:59 PM UTC+8, Feng Shen wrote:

 Hi,  nginx-clojure looks great!

 A small tip: ab may not be the best tool, since it's single threaded.   A 
 better tool is wrk:  https://github.com/wg/wrk

 You can use wrk to better test nginx-clojure,  It should perform even 
 better than others.




 沈锋
 http://shenfeng.me


 On Tue, Jan 14, 2014 at 5:26 PM, Peter Taoussanis 
 ptaou...@gmail.comjavascript:
  wrote:

 Oh wow, that's fantastic!

 For those watching: Xfeep's fixed a number of config issues, updated all 
 the servers, and completely updated the chart.

 Absolutely well worth a look if you're interested in Clojure web server 
 performance.

 * Results are here: 
 https://github.com/ptaoussanis/clojure-web-server-benchmarks
 * His GitHub page: https://github.com/xfeep
 * His nginx/clojure lib: https://github.com/xfeep/nginx-clojure

 Cheers! :-)

 -- 
 *Peter Taoussanis*
  
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups Clojure group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/clojure/UrRLCdex7d4/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 clojure+u...@googlegroups.com javascript:.
 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.


Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-14 Thread Xfeep Zhang
Hi Mingli, 

Thanks for  your suggestion.

Nginx-Clojure is quite different from uwsgi when supports JVM.

Nginx-Clojure make JVM embed into Nginx worker process. JVM and Nginx 
worker have  the same memory process space.

 Nginx-Clojure heavy uses pointer operation just like C to handle memory 
with Nginx worker. 

 If I'm not wrong,  uwsgi create every process for every request, or shared 
JVM processes between request?

When using Nginx-Clojure there's no IPC cost  even no thread switch cost if 
jvm_workers = 0 which is default.

So it's why Nginx-Clojure is so fast! 


On Wednesday, January 15, 2014 3:07:13 AM UTC+8, Mingli Yuan wrote:

 Hi, Xfeep,

 Thanks for your contribution, and the project looks interesting.

 For me, the idea of driving ring webapp behind nginx is not new. 
 We use uwsgi to drive our ring app behind nginx in our production.
 uwsgi support JVM and ring for almost one year, and I think the code is 
 relative stable right now.

 - it support a native protocol between nginx and uwsgi which is more 
 efficient than http
 - it support unix socket
 - and a rich uwsgi api layer to provide some means to communicate between 
 webapps
 - and according to the performance tests by the author, it is a little bit 
 faster than jetty.

 It is on our production for half a year, quite stable, and very harmonious 
 with the python app.

 I am not want to sale the solution of uwsgi, but it worth taking a look 
 and make some comparison.

 Regards,
 Mingli


 On Tue, Jan 14, 2014 at 9:12 PM, Xfeep Zhang easy...@163.comjavascript:
  wrote:

 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 
 HEREhttps://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-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarkshosted
  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-benchmarkshttps://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 
 1 concurrents. (when  = 1000 concurrents nginx-clojure is faster 
 than 
 http-kit.)
 I have set too many connections per nginx worker (worker_connections 
 = 2) . This make nginx only use one worker to handle ab  requests 
 (every request is tiny).
 I plan to take note of 
 c-erlang-java-performancehttp://timyang.net/programming/c-erlang-java-performance/and
  fork 
 clojure-web-server-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarksto
   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 1 concurrents  (Concurrency Level:  10 in  
 the 
 ab report ).
 2. In the small string test, All results about

Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-14 Thread Xfeep Zhang
I have check the uwsgi document again and the JVM integration document is 
HERE 
http://uwsgi-docs.readthedocs.org/en/latest/JWSGI.htmlhttp://uwsgi-docs.readthedocs.org/en/latest/JWSGI.html
 .

When using uwsgi to integrate JVM, the JVM process is not the same process 
of Nginx worker.

So it can not avoid IPC cost or socket cost ! So it will use more system 
handle (at least double ones) and more copy operataion between process 

and maybe more memory cost.

So I think using uwsgi to integrate JVM maybe will not be so fast!


On Wednesday, January 15, 2014 10:10:40 AM UTC+8, Xfeep Zhang wrote:

 Hi Mingli, 

 Thanks for  your suggestion.

 Nginx-Clojure is quite different from uwsgi when supports JVM.

 Nginx-Clojure make JVM embed into Nginx worker process. JVM and Nginx 
 worker have  the same memory process space.

  Nginx-Clojure heavy uses pointer operation just like C to handle memory 
 with Nginx worker. 

  If I'm not wrong,  uwsgi create every process for every request, or 
 shared JVM processes between request?

 When using Nginx-Clojure there's no IPC cost  even no thread switch cost 
 if jvm_workers = 0 which is default.

 So it's why Nginx-Clojure is so fast! 


 On Wednesday, January 15, 2014 3:07:13 AM UTC+8, Mingli Yuan wrote:

 Hi, Xfeep,

 Thanks for your contribution, and the project looks interesting.

 For me, the idea of driving ring webapp behind nginx is not new. 
 We use uwsgi to drive our ring app behind nginx in our production.
 uwsgi support JVM and ring for almost one year, and I think the code is 
 relative stable right now.

 - it support a native protocol between nginx and uwsgi which is more 
 efficient than http
 - it support unix socket
 - and a rich uwsgi api layer to provide some means to communicate between 
 webapps
 - and according to the performance tests by the author, it is a little 
 bit faster than jetty.

 It is on our production for half a year, quite stable, and very harmonious 
 with the python app.

 I am not want to sale the solution of uwsgi, but it worth taking a look 
 and make some comparison.

 Regards,
 Mingli


 On Tue, Jan 14, 2014 at 9:12 PM, Xfeep Zhang easy...@163.com wrote:

 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 
 HEREhttps://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-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarkshosted
  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-benchmarkshttps://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.comwrote:


 So far I have found why nginx-clojure is slower than http-kit when 
 1 concurrents. (when  = 1000 concurrents nginx-clojure is faster 
 than 
 http-kit.)
 I have set too many connections per nginx worker 
 (worker_connections = 2) . This make nginx only

Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-13 Thread Xfeep Zhang
You're welcome.

I think there are several difficult phases :

(1)  update the test program in 
clojure-web-server-benchmarkshttps://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 
libdrizzlehttps://launchpad.net/drizzlea 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.comjavascript:
  wrote:


 So far I have found why nginx-clojure is slower than http-kit when 1 
 concurrents. (when  = 1000 concurrents nginx-clojure is faster than 
 http-kit.)
 I have set too many connections per nginx worker (worker_connections = 
 2) . This make nginx only use one worker to handle ab  requests (every 
 request is tiny).
 I plan to take note of 
 c-erlang-java-performancehttp://timyang.net/programming/c-erlang-java-performance/and
  fork 
 clojure-web-server-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarksto
   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 1 concurrents  (Concurrency Level:  10 in  the 
 ab report ).
 2. In the small string test, All results about three server are about 10 
 concurrents. NOT 1 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:  1*
 Time taken for tests:   6.303 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  298220 bytes
 HTML transferred:   296860 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 433041
 Processing:25  124 112.9 963523
 Waiting:8   47  99.4 283523
 Total: 52  452 544.51574546

 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 (1 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:  1*
 Time taken for tests:   2.834 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  1700 bytes
 HTML transferred:   150 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.6118 178
 Processing:73  150  33.8146 263
 Waiting:   42  110  32.0104 246
 Total:177  268  25.6269 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:  1*
 Time taken for tests:   2.691 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  1340 bytes
 HTML transferred:   150 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.21141094

Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-12 Thread Xfeep Zhang
Sorry for my mistake!

1. In the static file test, the result is about 10 concurrents. NOT 1 
concurrents  (Concurrency Level:  10 in  the ab report ). 
2. In the small string test, All results about three server are about 10 
concurrents. NOT 1 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:  1
Time taken for tests:   6.303 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  298220 bytes
HTML transferred:   296860 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 433041
Processing:25  124 112.9 963523
Waiting:8   47  99.4 283523
Total: 52  452 544.51574546

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 (1 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:  1
Time taken for tests:   2.834 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1700 bytes
HTML transferred:   150 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.6118 178
Processing:73  150  33.8146 263
Waiting:   42  110  32.0104 246
Total:177  268  25.6269 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:  1
Time taken for tests:   2.691 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1340 bytes
HTML transferred:   150 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.21141094
Processing:31  134  26.1136 344
Waiting:   21   81  33.5 71 273
Total:183  252  43.82511435

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:  1
Time taken for tests:   9.740 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1670 bytes
HTML transferred:   150 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 113006
Processing: 0   51 207.6  57050
Waiting:0   39 204.5  47050
Total:  0  244 482.0 288080

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.pngNginx-Clojure
  
 is a Nginx http://nginx.org/ module for embedding Clojure or Java 
 programs, typically those 
 Ringhttps://github.com/ring-clojure/ring/blob/master/SPECbased handlers.

 There are some core features :

1

Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-12 Thread Xfeep Zhang
Sorry for my mistake!

1. In the static file test, the ring-jetty result is about 10 concurrents. 
NOT 1 concurrents  (Concurrency Level:  10 in  the ab report ).
2. In the small string test, All results about three server are about 10 
concurrents. NOT 1 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:  1*
Time taken for tests:   6.303 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  298220 bytes
HTML transferred:   296860 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 433041
Processing:25  124 112.9 963523
Waiting:8   47  99.4 283523
Total: 52  452 544.51574546

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 (1 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:  1*
Time taken for tests:   2.834 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1700 bytes
HTML transferred:   150 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.6118 178
Processing:73  150  33.8146 263
Waiting:   42  110  32.0104 246
Total:177  268  25.6269 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:  1*
Time taken for tests:   2.691 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1340 bytes
HTML transferred:   150 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.21141094
Processing:31  134  26.1136 344
Waiting:   21   81  33.5 71 273
Total:183  252  43.82511435

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:  1*
Time taken for tests:   9.740 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1670 bytes
HTML transferred:   150 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 113006
Processing: 0   51 207.6  57050
Waiting:0   39 204.5  47050
Total:  0  244 482.0 288080

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.pngNginx-Clojure
  
 is a Nginx http://nginx.org/ module for embedding Clojure or Java 
 programs, typically those 
 Ringhttps://github.com/ring-clojure/ring/blob/master/SPECbased handlers.

 There are some core

Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-12 Thread Xfeep Zhang

So far I have found why nginx-clojure is slower than http-kit when 1 
concurrents. (when  = 1000 concurrents nginx-clojure is faster than 
http-kit.)
I have set too many connections per nginx worker (worker_connections = 
2) . This make nginx only use one worker to handle ab  requests (every 
request is tiny).
I plan to take note of 
c-erlang-java-performancehttp://timyang.net/programming/c-erlang-java-performance/and
 fork 
clojure-web-server-benchmarkshttps://github.com/ptaoussanis/clojure-web-server-benchmarksto
  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 1 concurrents  (Concurrency Level:  10 in  the 
 ab report ).
 2. In the small string test, All results about three server are about 10 
 concurrents. NOT 1 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:  1*
 Time taken for tests:   6.303 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  298220 bytes
 HTML transferred:   296860 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 433041
 Processing:25  124 112.9 963523
 Waiting:8   47  99.4 283523
 Total: 52  452 544.51574546

 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 (1 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:  1*
 Time taken for tests:   2.834 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  1700 bytes
 HTML transferred:   150 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.6118 178
 Processing:73  150  33.8146 263
 Waiting:   42  110  32.0104 246
 Total:177  268  25.6269 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:  1*
 Time taken for tests:   2.691 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  1340 bytes
 HTML transferred:   150 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.21141094
 Processing:31  134  26.1136 344
 Waiting:   21   81  33.5 71 273
 Total:183  252  43.82511435

 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:  1*
 Time taken for tests:   9.740 seconds
 Complete requests:  10
 Failed requests:0
 Write errors:   0
 Total transferred:  1670 bytes
 HTML transferred:   150 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 113006
 Processing: 0   51 207.6  57050
 Waiting:0   39 204.5  47050
 Total

Re: Clojure web server benchmarks

2014-01-12 Thread Xfeep Zhang

If reduce worker_connections from 2 to 1024 or 128, I think nignx will 
be the fastest one in this test (the max concurrent level is only 96).



On Saturday, January 5, 2013 11:52:57 PM UTC+8, Peter Taoussanis wrote:

 Hi all,

 Quick post to mention that I've put up some rough benchmarks for a number 
 of Clojure web servers: 
 https://github.com/ptaoussanis/clojure-web-server-benchmarks.

 Getting semi-reliable numbers was a real PITA, and I'm sure there's still 
 plenty of room left for improvement (suggestions welcome!). Usual 
 disclaimers apply: the numbers vary by hardware, by OS, by concurrency, and 
 by the response size (among other things). The servers also vary 
 considerably in their feature sets. Not to mention that your web server is 
 seldom going to be the bottleneck when generating dynamic content. Tl;dr: 
 this is all very difficult to generalize: you'll need to bench in your own 
 environment with your own workloads to get an accurate picture.

 Anyway I think the numbers are interesting (and pretty impressive 
 all-round). Nginx can almost certainly be tweaked faster (ideas?), but I 
 wouldn't have expected something like the standard Ring Jetty adapter even 
 to be playing in the same ballpark - so that's nice.

 I'll try keep this updated as servers are updated. And as I've mentioned 
 on the GitHub page, pull-requests welcome for anything I may have missed, 
 including other servers or mis-configurations, etc. Hopefully with some 
 tweaking we can converge on some reasonably accurate/useful common-case 
 numbers.

 Cheers!


-- 
-- 
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.


Re: Clojure web server benchmarks

2014-01-12 Thread Xfeep Zhang
In this test there are other problems which maybe unfriendly to Nginx.

(1) Nginx will read the file from DISK  for EVERY request. Again the 
sendfile is disabled.  Worse! Although OS will cahed this file but KERNEL 
- Nginx Process Space will still cost a lot.

(2) Both Ring-Jetty and Http-kit just write the memory string to every 
request because the file has been load into Clojure var response.


See the code : 

(def response {:status 200 :headers {content-type text/html}
 :body (slurp resources/index.html)
 })

  Handlers

 (defn handler [request] response)





On Monday, January 13, 2014 12:10:40 PM UTC+8, Xfeep Zhang wrote:


 If reduce worker_connections from 2 to 1024 or 128, I think nignx will 
 be the fastest one in this test (the max concurrent level is only 96).



 On Saturday, January 5, 2013 11:52:57 PM UTC+8, Peter Taoussanis wrote:

 Hi all,

 Quick post to mention that I've put up some rough benchmarks for a number 
 of Clojure web servers: 
 https://github.com/ptaoussanis/clojure-web-server-benchmarks.

 Getting semi-reliable numbers was a real PITA, and I'm sure there's still 
 plenty of room left for improvement (suggestions welcome!). Usual 
 disclaimers apply: the numbers vary by hardware, by OS, by concurrency, and 
 by the response size (among other things). The servers also vary 
 considerably in their feature sets. Not to mention that your web server is 
 seldom going to be the bottleneck when generating dynamic content. Tl;dr: 
 this is all very difficult to generalize: you'll need to bench in your own 
 environment with your own workloads to get an accurate picture.

 Anyway I think the numbers are interesting (and pretty impressive 
 all-round). Nginx can almost certainly be tweaked faster (ideas?), but I 
 wouldn't have expected something like the standard Ring Jetty adapter even 
 to be playing in the same ballpark - so that's nice.

 I'll try keep this updated as servers are updated. And as I've mentioned 
 on the GitHub page, pull-requests welcome for anything I may have missed, 
 including other servers or mis-configurations, etc. Hopefully with some 
 tweaking we can converge on some reasonably accurate/useful common-case 
 numbers.

 Cheers!



-- 
-- 
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.


Re: Clojure web server benchmarks

2014-01-12 Thread Xfeep Zhang
You are welcome.
My Github user name is xfeep. 
I'm glad to join the repo. Thanks for your invitation!
 


On Monday, January 13, 2014 2:42:44 PM UTC+8, Peter Taoussanis wrote:

 Hi Xfeep,

 Thank you, I could never understand what configuration (setting) was 
 wrong. I do not have time to update the project now, but if you give me 
 your GitHub user name - I can add you to the repo?

 You can update the tests and/or results if you want to.

 Thank you also for your work on nginx-Clojure!

 Cheers :-)

 -- 
 *Peter Taoussanis*

 https://www.taoensso.com
  

-- 
-- 
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.


Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-10 Thread Xfeep Zhang
  95%  0
  98%  0
  99%  0
 100%  4 (longest request)


(2) http-kit 2.1.16
===

Document Path:  /
Document Length:15 bytes

Concurrency Level:  10
Time taken for tests:   2.424 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1340 bytes
HTML transferred:   150 bytes
Requests per second:41258.40 [#/sec] (mean)
Time per request:   0.242 [ms] (mean)
Time per request:   0.024 [ms] (mean, across all concurrent requests)
Transfer rate:  5399.05 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.0  0   1
Processing: 00   0.1  0   4
Waiting:00   0.1  0   3
Total:  00   0.1  0   5

Percentage of the requests served within a certain time (ms)
  50%  0
  66%  0
  75%  0
  80%  0
  90%  0
  95%  0
  98%  0
  99%  0
 100%  5 (longest request)


(3) ring-jetty
=

Document Path:  /
Document Length:15 bytes

Concurrency Level:  10
Time taken for tests:   3.445 seconds
Complete requests:  10
Failed requests:0
Write errors:   0
Total transferred:  1670 bytes
HTML transferred:   150 bytes
Requests per second:29030.44 [#/sec] (mean)
Time per request:   0.344 [ms] (mean)
Time per request:   0.034 [ms] (mean, across all concurrent requests)
Transfer rate:  4734.46 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.0  0   1
Processing: 00   0.1  0   4
Waiting:00   0.1  0   4
Total:  00   0.1  0   4

Percentage of the requests served within a certain time (ms)
  50%  0
  66%  0
  75%  0
  80%  0
  90%  0
  95%  0
  98%  1
  99%  1
 100%  4 (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.pngNginx-Clojure
  
 is a Nginx http://nginx.org/ module for embedding Clojure or Java 
 programs, typically those 
 Ringhttps://github.com/ring-clojure/ring/blob/master/SPECbased handlers.

 There are some core features :

1. Compatible with 
 Ringhttps://github.com/ring-clojure/ring/blob/master/SPECand 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 
 Nginxhttp://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 
 sitehttps://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 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.


Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-09 Thread Xfeep Zhang


[image: Alt 
text]https://github.com/xfeep/nginx-clojure/blob/master/logo.pngNginx-Clojure 
is a Nginx http://nginx.org/ module for embedding Clojure or Java 
programs, typically those 
Ringhttps://github.com/ring-clojure/ring/blob/master/SPECbased handlers.

There are some core features :

   1. Compatible with 
Ringhttps://github.com/ring-clojure/ring/blob/master/SPECand 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 
Nginxhttp://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 
sitehttps://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 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.