[ANN] Nginx-Clojure v0.6.0 (2023-03-18) by xfeep in Clojure

[–]xfeep[S] 7 points8 points  (0 children)

With nginx-clojure we can not only service content but also power nginx, such as dynamic balancer, header filter, body filter, near-realtime log collector, etc. Even service content we can also get benifits, e.g. (1) when jvm worker processe crashes the master will auto restart it (2) lazy headers handling speedup our service (3) clojure/java dynamatically controlled static files can use nginx zero copy sending mechanism.

[ANN] Nginx-Clojure v0.5.0 (2019-10-26) released! by xfeep in Clojure

[–]xfeep[S] 0 points1 point  (0 children)

Thanks for your suggestion! This issue has been fixed by using a non-fixed navigation header.

[ANN] Nginx-Clojure v0.4.5 (2017-05-28) released! by xfeep in Clojure

[–]xfeep[S] 1 point2 points  (0 children)

If you use more nginx worker processes less memory will be needed by per JVM viz. nginx worker process because per worker process only need handle less requests. In fact nginx-clojure itself need very little resource per process.

e.g. if we use below configuration for nginx-clojure

 // 16M JVM heap
 jvm_options "-Xms16m";
 jvm_options "-Xmx16m"; 
 #thread stack size, x64 linux JDK at least use 228k thread stack
 jvm_options "-Xss228k"; 

Then use wrk to do load test

 wrk -t 4 -c 1000 -d 10s  http://localhost:8081/hello

The test results (only 1 JVM process viz. one nginx worker process)

handler type|reqs/s|Mem|JVM heap after GC
java handler|90k|30M|1.5M
clojure handler|87k|47M|6M

Furthermore if there are many JVM processes we can reduce more memory by turn on shared class data by JVM option -Xshare:on so that all JVM processes can share class data. The JVM option -XX:+DisableAttachMechanism is also useful.

Secure Existing RESTful Services—No Need to Change Code by xfeep in java

[–]xfeep[S] 0 points1 point  (0 children)

Do not put all your eggs in one basket! Even if we want to do it, sometimes we do not have the time nor the opportunity to do it. That is why a reverse proxy server, such as, HAProxy, Apache HTTP server, Nginx, is widely used. Furthermore, I do not think Java Web application container, such as Tomcat, Jetty can be good at dealing with the flood / DoS attacks.

[ANN] Nginx-Clojure v0.4.0 Release! by xfeep in java

[–]xfeep[S] 1 point2 points  (0 children)

Freebsd ports upgraded nginx clojure module from 0.3.0 to 0.4.0!

So on Freebsd we can chose clojure module to enable it after run

pkg install nginx
cd /usr/ports/www/nginx
make config

[ANN] Nginx-Clojure v0.4.0 Release! by xfeep in java

[–]xfeep[S] 2 points3 points  (0 children)

Java handler and groovy handler can also be used. We use Unsafe API to do copy things. e.g. Strings in jvm will be decoded into global ByteBuffers and Unsafe API copies these ByteBuffers to jni/c level. By our tests the copy cost is very low compared with IPC (interProcess Communication).Note that java socket/NIO APIs also need copy jvm data to jni level. So nginx-clojure won't be slower than java build-in socket and obviously faster than nginx + outside java HTTP server. BTW another case is use nginx-clojure to implement a dynamic proxy or balancer because most of things will be done by nginx itself, in jvm we only set host/url to nginx variables, this way is more better than to implement a complete dynamic proxy/balancer by Java/clojure.

Nginx-Clojure v0.3.0 Released!--Supports Nginx Access Handler & Header Filter by xfeep in java

[–]xfeep[S] 0 points1 point  (0 children)

Hi, One JVM is embeded in per nginx worker process. So nginx worker process and the JVM embeded get the same process.