-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ignition 8 Connector v2 - PR 5 #140
Conversation
0cd23bb
to
70652fd
Compare
45b59ae
to
474f053
Compare
Also, I imagine it's very possible that this PR will quickly grow in size during the review. To make things more manageable, if something has been resolved to your satisfaction, please feel free to 'Resolve conversation'. This will make the PR much easier to follow and hopefully ensure nothing gets buried or missed. |
@it-hms @TomKimsey Apologies for another ping. I meant to include the documentation link originally, but they are visible at https://hms-networks.github.io/IgnitionEwonConnector/. |
logger.error( | ||
"Exception Trace Messages: " | ||
+ Arrays.stream(ExceptionUtils.getThrowables(e)) | ||
.map(Throwable::getMessage) |
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.
message could be null, Not sure if this will be correctly collected and joined
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.
Adding check
TagManager.initialize(gatewayContext, connectorSettings); | ||
} catch (Exception e) { | ||
LOGGER.error( | ||
"An error occurred while starting the Ignition Ewon Connector tag manager.", e); |
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 the connector continue? Or should it exit 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.
Might as well exit -- Adding a startup success flag.
dmWebPollingThread = | ||
new DMWebPollingThread( | ||
dmWebPollingInterval, dmWebPollingIntervalUnit, this, connectorSettings); | ||
dmWebPollingThread.start(); |
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.
Could throw exception executor service has been shutdown. I guess that is very unlikely.
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 think this is unnecessary. If the Ignition executor service were shut down, it's very unlikely the module is running/at this point in the code. If it were, I would expect that something would have gone very wrong for the module to still be executing.
gatewayHook | ||
.getGatewayContext() | ||
.getExecutionManager() | ||
.unRegister(IgnitionEwonConnectorHook.BUNDLE_PREFIX_EWON, threadName); |
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.
There is also a shutdown method. The limited docs state will gracefully shutdown. Should this be called before unregister?
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 is the execution manager of Ignition gateway. Shutting it down would likely have disastrous results.
* | ||
* @since 1.0.0 | ||
*/ | ||
private static final int CONNECTION_REQUEST_TIMEOUT_SECS = 900; |
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.
900 seconds for a connection request? this seems like a really long amount of time. 30 seconds sound more reasonable.
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 is not a timeout for the HTTP request/connection itself. It is a timeout where the request can sit in a queue and wait to be performed.
This is necessary to support extremely large Ewon count environments, where, for example, a metadata update can result in hundreds of requests being performed. Due to the throughput limitations of Talk2M/M2Web, all requests cannot be done simultaneously, therefore the connector must have the capacity to queue those requests.
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.
During testing, metadata updates can take a large amount of time. Extending this timeout from its default, which is rather short, significantly reduces the possibility that cascading failures can extend metadata updating much longer.
For example:
- Scenario 1: Cxn Request Timeout is Default
- Metadata and tag update requests are queued for 200 Ewons at once
- 50 requests are successful. The remaining 150 fail because of a cxn request timeout
- Due to throughput limitations, the requests simply could not have been started sooner and timed out before they could even be attempted
- Scenario 2: Cxn Request Timeout is Increased (900)
- Metadata and tag update requests are queue for 200 Ewons at once
- 200 requests are successful. None fail due to the increased cxn request timeout
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 this be renamed to provided a better description of its functionality
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.
Would you happen to have any suggestions?
I hoped the comment provided context because these timeout variable names align with their counterpart names in the HTTP library itself.
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.
Would CONNECTION_REQUEST_QUEUE_TIMEOUT_SECS work?
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. Will update
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.
Updated
// Create connection manager | ||
try { | ||
asyncClientConnectionManager = new PoolingAsyncClientConnectionManager(); | ||
asyncClientConnectionManager.setMaxTotal(HTTP_CXN_POOL_MAX_REQUESTS); |
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 seems like a lot. Could be memory intensive.
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 is necessary to buffer requests and, similar to the Cxn request timeout, is large enough to support accounts with many Ewons.
The memory intensity would be related/tied to the number of Ewons on the account, which influences the number of necessary requests.
.build(); | ||
httpAsyncClient.start(); | ||
} catch (Exception e) { | ||
LOGGER.error("Failed to create HTTP connection manager.", e); |
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 application continue if there is an error 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.
Might as well exit -- Adding a return value and using it to update the startup success flag
*/ | ||
public static Future<M2WebGetEwonsResponse> getEwonGatewayList( | ||
CommunicationAuthInfo communicationAuthInfo) { | ||
FutureCallback<SimpleHttpResponse> httpResponseFutureCallback = null; |
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 this used? the callback is null?
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 method stub is used.
Several additional method stubs were implemented because a large portion of the M2Web/DMWeb API code was designed to be close to/similar to a library, allowing us to reuse code in the future easily.
The callback is null
because we are waiting on the future (non-async request), and the callback is unused by the calling code.
I did not get a chance to fully review. I did not see any errors or anything that would require changes, but I did have some questions about should the code exit in some places. |
Adds the ExceptionUtilities class which provides useful functionality for working with exceptions, including printing of the message text for an entire exception trace.
56962d2
to
24a3d64
Compare
24a3d64
to
b45c1ee
Compare
Replaced the existing GatewayHook.java class with the new IgnitionEwonConnectorHook.java class which has been rewritten to support asynchronous HTTP requests and multithreaded response handling.
Adding this gateway hook variable to the polling thread class allows for threads to trigger a connector shutdown in the event of an unknown critical error.
Improve the polling thread class by migrating it to use the internal Ignition execution manager and adding an assigned name.
Improve the performance of the AsyncHttpRequestManager class by explicitly defining a number of parameters, including response timeout, connection request timeout, IO thread count, and increased route configuration.
b45c1ee
to
1a5b999
Compare
Still reviewing, this is not forgotten. |
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.
Please standardize on the number of blank newlines at the end of md/x files. It should either be 0 or 1 for consistency.
...rc/main/java/com/hms_networks/americas/sc/ignition/threading/M2WebMetadataPollingThread.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/hms_networks/americas/sc/ignition/threading/M2WebMetadataPollingThread.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/hms_networks/americas/sc/ignition/threading/M2WebMetadataPollingThread.java
Outdated
Show resolved
Hide resolved
The minimum hardware requirements are suitable for a small number of devices and tags. If you are planning to connect | ||
many devices or tags, you should consider increasing the hardware resources available to Ignition and its modules. | ||
|
||
These requirements match those of Ignition, with additional memory (RAM) required for the connector to run. |
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.
How was this determined
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.
There is no advanced determination here. It is simply the Ignition requirements with additional memory to support the connector. The connector will use at least some memory, but the amount of tags/Ewons really controls the amount.
The idea of adding a minimum beyond what the Ignition defaults are is that 'guarantees' that the connector has its own dedicated resources of some amount. It also brings to attention that system resources, including memory, must be considered, as mentioned in the larger comment for the recommended hardware.
In many cases, the minimum hardware requirements may be adequate (for example, my developer/testing account with only a handful of Ewons + date has no issue with 4 GB). The minimum requirement of 4 GB can still cause concern on large customer systems, though, where hundreds of tags and Ewons are in place. Upping to 8 GB, in that case, may improve the connector performance and reduce the change of Ignition time/clock drift due to the connector overloading the system.
resources available to Ignition will limit the number of devices and tags that can be connected. If you experience | ||
a degradation in performance, it is recommended to increase the hardware resources available to Ignition and its |
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 you mention network as a source of performance degradation?
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.
Added a small message that network bandwidth could be increased.
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 think this probably should get rephrased. The way it reads right now is if you have any performance issue you should get a better cpu, increase ram, increase network bandwidth, and increase hdd space.
a protentional issue could read
Title
"Rephrase performance degradation section in web-docs/docs/_partial/_sys_req_hardware.mdx"
Msg
"Rephrase section to add some protentional troubleshooting steps to identify and resolve the bottleneck"
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.
You might even rephrase to say that decreased or sub optimal performance could be due to one or more of the following: cpu availability/speed, memory, network, disk space, etc.
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.
Issue #145 was created
1a5b999
to
36406c0
Compare
Fixed a bug with the Ewon-specific realtime override property which allowed it to be configured once, but not be detected or loaded when the connector restarts or boots.
Updated the javadoc for #DEFAULT_LIVE_POLL_RATE in the EwonConnectorSettings class to use the correct time unit of minutes instead of seconds.
Add a success/failure return tag to the initialize method in AsyncHttpRequestManager.java so that the connector start up can be aborted if there is a failure.
Improve the branding throughout the connector by more consistently referencing the connector name as Ignition Ewon Connector. Additionally, eWon is being corrected to Ewon where possible. The Ignition Maven Plugin was also updated to support improved build version display on the Ignition UI. Note: Further branding improvements will be completed after v2.0.0 release to alleviate the need for multiple rebases during dev.
Migrated existing documentation to the new Solution Center Docusaurus system, including reorganization and setup. Additionally, the documentation was updated or added to in order to reflect changes made in the v2.0.0 release.
resources available to Ignition will limit the number of devices and tags that can be connected. If you experience | ||
a degradation in performance, it is recommended to increase the hardware resources available to Ignition and its |
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 think this probably should get rephrased. The way it reads right now is if you have any performance issue you should get a better cpu, increase ram, increase network bandwidth, and increase hdd space.
a protentional issue could read
Title
"Rephrase performance degradation section in web-docs/docs/_partial/_sys_req_hardware.mdx"
Msg
"Rephrase section to add some protentional troubleshooting steps to identify and resolve the bottleneck"
I misnumbered the last PR as No.3 when it should've been No.4, so this PR is No.5.
I've updated the previously mentioned PR timeline below:
45 - Last significant PR, containing documentation and additional source code changes56 - Small follow-up pull request to perform code signing and official release.5a6a - Just prior to v2 release (or after, depending on time constraints), a patch should be performed to finalize the Ewon rebranding efforts.