Comments (9)
- +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.
@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.
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.
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.
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.
@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.
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.
@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.
@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)
- Derive a new `XdsBootstrap` with `StaticResources`
- who use armeria ? HOT 1
- Support for `@Attribute` in annotated services HOT 4
- Handle an empty query parameters with `@Default` HOT 6
- `RetryingClient` propagates the exception (and whether it is unprocessed) HOT 2
- Make DocService looking up several virtual hosts to represent services in other ports
- Replace `Optional<List<T>>` parameter to `ObjectProvider<T>` HOT 3
- Leak in `ArmeriaHttpPutTest`
- Client-side load balancing for same Endpoint HOT 1
- Add ServerExtension.webSocketClient() for testing
- Do not ignore the result of StreamMessage.tryWrite() in GraphqlWSSubProtocol HOT 6
- Test failure: `com.linecorp.armeria.server.ServerRequestPathEncodingTest` HOT 2
- Make annotated services reject the multipart requests that contain an uninjectable file upload HOT 2
- Make `GrpcStatus` implement `GrpcExceptionHandlerFunction` HOT 2
- Preemptively close the channel when receiving SslCloseCompletionEvent HOT 1
- Make `ClientRequestContext.authority()` and `host()` return non-null HOT 2
- Is it possible to send a ping frame over HTTP/2 using Armeria? HOT 5
- Consider closing a request when the response is exceptionally completed
- Enhance DefaultUnhandledExceptionsReporter for Better Exception Reporting HOT 2
- Support gRPC cancellation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from armeria.