Reduce the number of renderer processes

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Reduce the number of renderer processes

Postby feng » Tue Feb 07, 2017 2:12 am

Hi,
Our MFC application using CEF (cef_binary_3.2623.1401.gb90a3be_windows32,multi-process, and same exe name for browser/gpu/render) is running well.

But we run too many web at the same time ,when the application start,we load eight url,so it have ten process ( 1 browser +1 gpu + 8 renderer).

How can we reduce the number of renderer processes.

My English is not good enough,thank you for your help.

Thank you for cef team !
feng
Techie
 
Posts: 16
Joined: Sun Feb 14, 2016 4:29 am

Re: Reduce the number of renderer processes

Postby amaitland » Tue Feb 07, 2017 2:33 am

The standard Chromium process models apply

https://www.chromium.org/developers/des ... ess-models
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Reduce the number of renderer processes

Postby amaitland » Tue Feb 07, 2017 2:42 am

https://cs.chromium.org/chromium/src/co ... e=cs&l=784

There may be another option. If you experience problems revert to the standard model.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Reduce the number of renderer processes

Postby sbush1310 » Tue Feb 07, 2017 5:15 pm

For our app, we reduce the maximum allowed renderer processes with the following bit of code in our CefApp derived class:

Code: Select all
void CMyCefApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
{
   if (m_maximumRendererProcesses != -1)
   {
      command_line->AppendSwitchWithValue(L"--renderer-process-limit", INT_TO_STRING(m_maximumRendererProcesses));
   }
}

void CPPCefApp::SetMaximumRendererProcesses(int pMaxRendererProcesses)
{
//CALL BEFORE CefInitialize()
   m_maximumRendererProcesses = pMaxRendererProcesses;
}


When this is done, the renderer processes are shared between multiple windows. For low refresh or js usage pages, this seems to work fine.
sbush1310
Techie
 
Posts: 16
Joined: Thu Jan 07, 2016 5:15 pm

Re: Reduce the number of renderer processes

Postby feng » Wed Feb 08, 2017 1:11 am

amaitland wrote:https://cs.chromium.org/chromium/src/content/public/common/content_switches.cc?q=kRendererProcessLimit&sq=package:chromium&type=cs&l=784

There may be another option. If you experience problems revert to the standard model.





you give the link is can't open in my area,but i think that's mean using command_line->AppendSwitchWithValue("renderer-process-limit", "3").

if i using "renderer-process-limit" ,sometimes some web is not display normal,example white page.

thank you for your help!
feng
Techie
 
Posts: 16
Joined: Sun Feb 14, 2016 4:29 am

Re: Reduce the number of renderer processes

Postby feng » Wed Feb 08, 2017 1:12 am

sbush1310 wrote:For our app, we reduce the maximum allowed renderer processes with the following bit of code in our CefApp derived class:

Code: Select all
void CMyCefApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
{
   if (m_maximumRendererProcesses != -1)
   {
      command_line->AppendSwitchWithValue(L"--renderer-process-limit", INT_TO_STRING(m_maximumRendererProcesses));
   }
}

void CPPCefApp::SetMaximumRendererProcesses(int pMaxRendererProcesses)
{
//CALL BEFORE CefInitialize()
   m_maximumRendererProcesses = pMaxRendererProcesses;
}


When this is done, the renderer processes are shared between multiple windows. For low refresh or js usage pages, this seems to work fine.





if i using "renderer-process-limit" ,sometimes some web is not display normal,example white page.

thank you for your help.
feng
Techie
 
Posts: 16
Joined: Sun Feb 14, 2016 4:29 am

Re: Reduce the number of renderer processes

Postby amaitland » Wed Feb 08, 2017 1:34 am

If your browsers load pages from the same site you can use --process-per-site to consolidate the number of processes.

In general I'd avoid changing process limits as the results can be unpredictable.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 90 guests