-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spike: Simplify styx servers and inject executors #578
Conversation
StyxServerTest (test-api): Use a dynamic HTTP port number. Remove an accidental character from styx FT suite logback.xml.
This adds 'inetAddress' method to StyxService.
… new server objects.
|
||
import static com.hotels.styx.StyxConfig.NO_JVM_ROUTE_SET; | ||
import com.hotels.styx.api.LiveHttpRequest; | ||
|
||
/** | ||
* Formats response info into a string. | ||
*/ | ||
|
||
// TODO: Should be package private, but it is shared by com.hotels.styx.servers.StyxHttpServer.kt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need a TODO here. It's a trivial problem and the TODO will be there forever and will never get fixed. Better would be to fix it by moving StyxHttpServer to com.hotels.styx package or just remove comment.
field("port", integer()), | ||
field("handler", string()) | ||
|
||
// optional("tlsSettings", `object`( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to submit commented out code?
|
||
class StyxHttpServerTest : StringSpec() { | ||
|
||
init { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to commit an empty test?
* @return event loop group | ||
*/ | ||
EventLoopGroup newBossEventLoopGroup(); | ||
public interface IStyxServer extends StyxService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to create this interface? only one class implements it
} | ||
public Void call() { | ||
channelGroup.close().awaitUninterruptibly(); | ||
// TODO: Mikko: check why the return value is never used: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should your name be in the code? :)
Netty Servers Spike
Goal is to prepare core styx classes to accommodate http2 server implementation.
Server Configuration
Utilise existing Styx Config Object model and its underpinning framework for configuring Styx servers. This involves adding a new
servers
configuration map like so:Styx http2 will eventually be implemented as a
Http2Server
server object.Benefits:
Styx is no longer limited to a pair of
http
orhttps
endpoints. Users specify as many servers as they want.Simplify & reduce Styx server implementation. We will handle routing objects, control plane providers, and Styx servers with same underlying framework. Thus we can cut down any bespoke code that is specific to the styx servers alone.
(PR Refactor ProviderObjectRecord #582) As a part of this work, the
ProviderObjectRecord
has merged into a newStyxObject<T>
as follows :Netty Executors
(PR #583)
I have introduced new
NettyExecutor
class. It encapsulates a Netty event loop, and it corresponding client and server channel types.NettyExecutor.create
attempts to use an Epoll when available, and it reverts to NIO when not available. This replaces the functionality that used to be scattered acrossClientEventLoopFactory
,EpollClientEventLoopFactory
,NioEventLoopGroupFactory
, andPlatformAwareEventLoopGroupFactory
classes.We can now read the thread pool configuration etc in the
main
method from the styx configuration, instantiate executors accordingly, and inject them in to the class hierarchy.This reduces a need to pass styx configuration across several components.
Other improvements
ProxyServerbuilder
PR: #581
NettyServer
ServerListener
andServerSocketBinder
inner classes. This was made possible by earlier work to restrict only one server socket binder perNettyServer
.PR: #580