Hi,
I have no experience running CEF4Delphi inside a web service.
I guess it should be possible to use it if you create GlobalCEFApp once in the main service process and then create a bunch of TChromium in OSR mode to be reused by the web service threads.
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
CEF4 is thread safe? Or can be implemented?
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: CEF4 is thread safe? Or can be implemented?
This is "unexplored territory" for me because I've never used CEF4Delphi or any other web browser component inside a web service.
All CEF based applications have these limitations :
About the problem with 2 concurrent users : If you use a bunch of TChromium components created in the main process it should work fine but I've never tested this on a server. You should check that all CEF procedures that you need can be called from any thread.
All CEF based applications have these limitations :
- 1. CEF can only be initialized once per process : This means that GlobalCEFApp can only be created once and GlobalCEFApp.StartMainProcess can only be called once.
- 2. In case of DLLs, plugins or things like that you need to use a different EXE for the subprocesses. I guess that a web service will need it too.
- 3. If I remember correctly, Chromium can only create 80 browsers at the same time (I'm not 100% sure about the exact number). This is the reason why I suggested that you use a bunch of TChromium components in your case.
- 4. Windows limits the number of subprocesses created from the main process.
- 5. You need to use a cache directory. If you use "in-memory" cache you will easily run out of RAM.
About the problem with 2 concurrent users : If you use a bunch of TChromium components created in the main process it should work fine but I've never tested this on a server. You should check that all CEF procedures that you need can be called from any thread.