Code Monkey home page Code Monkey logo

Comments (9)

trustin avatar trustin commented on May 9, 2024
  • +1 for making the service name customizable.
  • Armeria currently uses its own thread pool for serving servlet requests (and other blocking tasks.) What happens when you add an executor to a service? Is a servlet/jsp handled in the executor instead of the blocking task executor Armeria uses?

from armeria.

trustin avatar trustin commented on May 9, 2024

@yfinkelstein on a side note, it's very exciting to hear there is an external customer to this project. Please keep your feed back coming! We're very happy to hear and discuss them. ❤️

from armeria.

yfinkelstein avatar yfinkelstein commented on May 9, 2024

Creation of a thread pool itself will not cause change in the threading model of Armeria. I have been running my servlets without this thread pool successfully. Something else inside of my servlets was failing to initialize, but it was our own custom logic that was assuming too much knowledge of the Tomcat environment.

Catalina Connector uses one of these executors to invoke the service adapter when dispatching the IO request to the Service Adapter. However, since you are bypassing the connector's IO listener and calling the Service Adapter directly with the request you can get away with your own thread pool.

Fyi, the default Tomcat distribution comes with conf/server.xml file, and in there, under Service, there is

  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
   ...

I don't know how this works down the last detail, but I believe somewhere in the connector (and btw there are many of them - Http, Ajp, Native, etc) there is a logic to dispatch the IO to one of these Executor instances.

Also, here https://tomcat.apache.org/tomcat-8.0-doc/config/executor.html
it says:

The executor is a nested element to the Service element. And in order for it to be picked up by the connectors, the Executor element has to appear *prior* to the Connector element in server.xml

from armeria.

yfinkelstein avatar yfinkelstein commented on May 9, 2024

More importantly, I'm not suggesting that you always create the executor as a part of tomcat creation sequence. I'm simply suggesting to allow the user to customize every details of the Tomcat configuration including the ability to create executors if so desired for some reason.

from armeria.

yfinkelstein avatar yfinkelstein commented on May 9, 2024

Regarding your side note,
I think the project has a big potential. In my mind, it belongs to some place around gRPC and Vert.x (the HTTP Server part of it). Both of these are specialized, but Armeria can become the low-level framework that does not prescribe a particular Http version, RPC payload format, and even allows for both Servlet and async API processing models. If you can evolve the REST API support Vert.x style and make gRPC work as a part of single Armeria Server instance that would really useful to many.

The following would be my version of "the best of the web" :)

        new ServerBuilder()
                .service (PathMapping.ofPrefix ("/admin/", false), TomcatService.forCurrentClassPath())
                .service (PathMapping.ofPrefix ("/grpc/", false), gRPCServiceBuilder.build(..))
                .service (PathMapping.ofPrefix ("/restAPI/svc1/", true), RestServiceBuilder.build(..))
                ...

.port(8080, SessionProtocol.HTTP).build().start();

And you're almost there!

from armeria.

trustin avatar trustin commented on May 9, 2024

@yfinkelstein #96 should solve this issue. And thank you very much for your input. We definitely have those in our road map. Please consider joining us by sending a PR (gRPC, REST, ...) ;-)

from armeria.

anuraaga avatar anuraaga commented on May 9, 2024

Somewhat tangential, and completely randomly I found this issue and sample code for spring-boot to implement graceful shutdown, we'll probably want something similar too

spring-projects/spring-boot#4657

from armeria.

trustin avatar trustin commented on May 9, 2024

@anuraaga I thought we already have graceful shutdown implemented and TomcatService should be covered by it as well because it's just a service?

from armeria.

trustin avatar trustin commented on May 9, 2024

@yfinkelstein Should be fixed, now that #96 has been merged. Please feel free to open another issue if that didn't work for you.

from armeria.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.