![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Sat, Sep 16 2017 3:52 PM | Permanent Link |
KimHJ Comca Systems, Inc | If several request at the same time is send to the webservers module. Will it EWBModuleExecute finish one at the time or will it create instant of the module and execute multi request at time?
The reason I ask is because I have one module that have two functions and they retrieve information from the database. I just want to know if I need to make it in a thread or it's ok to have it in a function as long I create instant of the database and auto sessions? Thanks, Kim |
Sun, Sep 17 2017 1:05 PM | Permanent Link |
Raul Globestar Systems ![]() | On 9/16/2017 3:52 PM, KimHJ wrote:
> If several request at the same time is send to the webservers module. Will it EWBModuleExecute finish one at the time or will it create instant of the module and execute multi request at time? Multiple requests from the same client or different clients ? > The reason I ask is because I have one module that have two functions and they retrieve information from the database. I just want to know if I need to make it in a thread or it's ok to have it in a function as long I create instant of the database and auto sessions? EWB web server does run modules in a thread and AFAIK each client connection gets its own thread. As per manual : "Each module instance is executed in a separate thread, so you must make sure that all code included in an OnExecute event handler is completely thread-safe." My interpretation of this would be that assume new instance each time module is called and make sure you're thread safe . You can easily test it out though with some debug logging Raul |
Tue, Sep 19 2017 4:57 PM | Permanent Link |
KimHJ Comca Systems, Inc | Raul wrote:
>>My interpretation of this would be that assume new instance each time module is called and make sure you're thread safe . You can easily test it out though with some debug logging<< Thanks. Kim |
Fri, Sep 22 2017 2:34 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Kim,
<< If several request at the same time is send to the webservers module. Will it EWBModuleExecute finish one at the time or will it create instant of the module and execute multi request at time? >> Each request will create a different instance of the module and trigger the OnCreate/OnExecute/OnDestroy event handlers for the module instance. However, each module instance lives in the same DLL instance, so any global instance updates like updating the properties of ElevateDB's global, singleton TEDBEngine component instance need to occur during the initialization/finalization phases of the module's main unit, not during the OnExecute event handler. If you try to do such property updates in the OnExecute event handler, you will create a race condition. So, you'll need to double-check about any other 3rd party products being used in your module to ensure that you're accessing them in a safe way for multi-threaded access. Tim Young Elevate Software www.elevatesoft.com |
Mon, Sep 25 2017 3:44 AM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> Each request will create a different instance of the module and trigger the OnCreate/OnExecute/OnDestroy event handlers for the module instance. I read this, and then I came back to clarify as there is a performance implication. Each and every request creates a module, and then destroys it. No caching involved. Is that correct? That's fine, because you know exactly where you are. Anyone connecting to a slow to create resource can manage that separately so that the performance is okay. Just being clear about it is what matters. -- Matthew Jones |
Fri, Sep 29 2017 3:32 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< I read this, and then I came back to clarify as there is a performance implication. Each and every request creates a module, and then destroys it. No caching involved. Is that correct? >> Correct. It has to be done this way because caching the module would involve changing the semantics of how the developer *uses* the module, thus breaking every module that relies on OnCreate/OnDestroy firing for every request. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Thursday, March 30, 2023 at 10:19 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |