-
Notifications
You must be signed in to change notification settings - Fork 114
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
Rpc Server Reliability Upgrades #619
Conversation
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.
minor comments so far, still reviewing
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.ThreadPoolExecutor; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.Optional; |
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 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.
fixed
@@ -93,24 +90,42 @@ public void makeSecure() throws Exception { | |||
@Override | |||
public void start() { | |||
try { | |||
// default to 1 thread to minimize resource consumption by nano http | |||
int tCount = 1; | |||
/** |
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 be comment /*
not java doc /**
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.
fixed
import org.slf4j.Logger; | ||
|
||
import java.util.Map; | ||
import java.util.Optional; |
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.
a number of imports are not 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.
fixed
} | ||
|
||
@Override | ||
public void handleRequest(HttpServerExchange exchange) throws Exception { |
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.
I don't see any exception being thrown here
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.
Fixed
@@ -26,16 +16,17 @@ | |||
import java.util.Map; | |||
|
|||
public class UndertowRpcServer extends RpcServer { | |||
|
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.
The RpcServer
class could include more of the common functionality between UndertowRpcServer
and NanoRpcServer
.
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.
I don't think there are any more commonalities that could be easily pulled up to the base class without expending some effort generifying and refactoring, which would unneccessarily complicate the implementation.
If you had some specific ideas, I'm all ears :) (but I think the implementations are simple enough and don't thing we have alot to gain by refactoring this class heirarchy).
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.
I was thinking that the LOG
and CORS_HEADERS
can be placed in the abstract class and perhaps the log debug printout with the options display.
@@ -115,25 +123,63 @@ public void fromXML(final XMLStreamReader sr) throws XMLStreamException { | |||
e.printStackTrace(); | |||
} | |||
break; | |||
case "threads": | |||
case "worker-threads": { |
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.
this may make old config files incompatible
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.
yes, that was the point. Initially, I had both threads
and worker-threads
map to the same case, but then I didn't want the user the explicitly set the worker-thread count unless they really knew what they were doing, so I ended up removing the threads
options altogether. The user would have to read through the RPC config wiki to find the appropriate option to constrain thread count.
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.
@ali-sharif do you tested the config file capabilities? Meaning the old version will not block the kernel running.
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.
Yes, tested that if threads
is declared in the config file, the kernel just ignores it and uses the default value, which was the behaviour I wanted to enforce. In general, if an xml node is found in the config but not in the mapper, it's just ignored.
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.
Is there a place where you document these breaking changes for things like config files? If I wouldn't have looked into the pull request, I don't know where I could've find this information. Also, given the fact that pools are very dependent on this configuration, we really need to have this information into the open.
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.
just to confirm, no breaking changes to the config. we spent a lot of time writing very detailed documentation on the RPC server https://github.com/aionnetwork/aion/wiki/JSON-RPC-API-Docs, which should have been communicated to the pools (we will try to remedy that soon)
@@ -171,7 +217,7 @@ String toXML() { | |||
xmlWriter.writeComment("boolean, enable/disable cross origin requests (browser enforced)"); | |||
xmlWriter.writeCharacters("\r\n\t\t\t"); | |||
xmlWriter.writeStartElement("cors-enabled"); | |||
xmlWriter.writeCharacters(String.valueOf(this.getCorsEnabled())); | |||
xmlWriter.writeCharacters(String.valueOf(this.isCorsEnabled())); |
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 weren't the other configuration options added here?
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.
As is stated in the RPC docs, the other settings are for advanced users and putting them in the config would just give users opportunity to tweak those settings without really knowing what those settings do.
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.
the advanced config settings for the rpc-server will disappear after executing./aion.sh -c
Is that an expected behavior?
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.
LGTM, one comment need to confirm.
1. Description
RequestBufferingHandler
which was causing the following error (and subsequent server shutdown) from Undertow:worker-threads
,io-threads
&request-queue-size
in the configuration.2. Type of change
Insert x into the following checkboxes to confirm (eg. [x]):
3. Testing
3.1 Resource Constrained Test
Legend: [avg requests per sec processed / success rate %]
** requests fail due to a combination of resource-busy due to blocking architecture & aggresive (2s) client timeout, but RPC server survives
4. Verification
Insert x into the following checkboxes to confirm (eg. [x]):