nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.36k stars 323 forks source link

If java supported #31

Closed binnn6 closed 5 years ago

binnn6 commented 7 years ago

Unit will work as tomcat or jetty if java supported? Or what it supposed todo?

VBart commented 7 years ago

It is currently in R&D stage. What would you suggest? We'd like to hear users opinions.

rmohta commented 6 years ago

@VBart Based on code for golang, it looks like you're starting a server via C code and then using FFI to interact with golang code. Is that right?

Also Do you have latency and throughput comparison to Netty 4 (netty-transport-native-epoll artifact)?

VBart commented 6 years ago

@rmohta That's right.

As of doing comparison to Netty, currently it doesn't make sense. While the architecture of Unit is designed to show the best performance, but on the current stage of development it's not expected.

rmohta commented 6 years ago

@vbart Okay. What is an ideal architecture for Unit? Is it to provide ability to expose APIs and provide a bridge to glue your service code? Something like Servless/fn platform or something else?

VBart commented 6 years ago

Ideally, when it's possible to integrate interpreter or virtual machine and load it as a dynamic module. PHP, Python and Ruby (coming soon) work that way.

linux-china commented 6 years ago

Any guy looked at GraalVM project? https://www.graalvm.org/ it's embeddable. GraalVM can be embedded in both managed and native applications. There are existing integrations into OpenJDK, Node.js, Oracle Database, and MySQL. If Oracle Database & MySQL can embed GraalVM, and I think Nginx Unit can embed GraalVM for Java.

VBart commented 6 years ago

@linux-china Thanks. That looks interesting.

mar0x commented 5 years ago

Experimental Java web app support added in https://github.com/mar0x/unit/tree/java . Currently it is able to run basic Spring Boot web applications, packaged as war (see https://github.com/mar0x/gs-spring-boot ).

ghost commented 5 years ago

is the plan to support any JVM based language in Unit ?

mar0x commented 5 years ago

We are going to implement a servlet container for web applications based on Java Servlet 3.1 Specification. Currently we focus on Java, but I hope the container will work with applications written in other JVM-based languages if the application follows the requirements like other containers do.

To prioritize, we'd like to know more about your application, the language used, and the ultimate goal you aim to achieve when running your application with Unit.

ghost commented 5 years ago

@mar0x we use Clojure within a JVM.

mar0x commented 5 years ago

Steve, I've tried basic Clojure web application. Being packaged as a standalone war, it works well under Unit with experimental Java support (https://github.com/mar0x/unit/tree/java).

mar0x commented 5 years ago

Static files serving introduced in experimental Java support. Looking for early adopters.

mar0x commented 5 years ago

Unit 1.8 may work as Tomcat or Jetty. Please refer to documentation (http://unit.nginx.org/configuration/#configuration-java) for more information.

avkarenow commented 5 years ago

No support for user/group settings for Java? Or just lack information in the documentation?

VBart commented 5 years ago

@avkarenow http://unit.nginx.org/configuration/#application-objects

Each application object has a number of common options that can be specified for any application regardless of its type.

incube8r commented 5 years ago

@VBart which version of Unit works with Java? I am using 1.8.0 but when uploading a JSON config it throws: "The module to run \"java\" is not found among the available application modules. "

mar0x commented 5 years ago

@incube8r BETA Java support introduced in Unit 1.8.0. You need to install JSC (Java Servlet Container) module. Please read http://unit.nginx.org/installation/ for you OS or consider installation from sources (http://unit.nginx.org/installation/#source-code).

incube8r commented 5 years ago

@mar0x that worked! Thanks!

I tried running a web app that works well with Tomcat, Jetty, and Payara (tested) but Unit does not seem to be able to run it, it throws this error:

Caused by: java.lang.SecurityException: Couldn't parse jurisdiction policy files in: unlimited
    at java.base/javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:357)
    at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:111)
    at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:108)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.crypto.JceSecurity.<clinit>(JceSecurity.java:107)
    ... 76 more 
incube8r commented 5 years ago

@mar0x that worked! Thanks!

I tried running a web app that works well with Tomcat, Jetty, and Payara (tested) but Unit does not seem to be able to run it, it throws this error:

Caused by: java.lang.SecurityException: Couldn't parse jurisdiction policy files in: unlimited
  at java.base/javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:357)
  at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:111)
  at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:108)
  at java.base/java.security.AccessController.doPrivileged(Native Method)
  at java.base/javax.crypto.JceSecurity.<clinit>(JceSecurity.java:107)
  ... 76 more 

I added the issue here https://github.com/nginx/unit/issues/255

cyberquarks commented 3 years ago

We are going to implement a servlet container for web applications based on Java Servlet 3.1 Specification. Currently we focus on Java, but I hope the container will work with applications written in other JVM-based languages if the application follows the requirements like other containers do.

To prioritize, we'd like to know more about your application, the language used, and the ultimate goal you aim to achieve when running your application with Unit.

Do NGINX Unit supports Servlet 3.1? @mar0x

mar0x commented 3 years ago

Do NGINX Unit supports Servlet 3.1?

Yes. @cyberquarks