[slowness] First request takes more time

51 views
Skip to first unread message

Velu Narasimman

unread,
Feb 4, 2020, 8:51:16 AM2/4/20
to Trac Users
Hi,

    I have hosted a trac instance in apache server with mod-wsgi. The first request to the application takes a huge time. Then subsequent requests also taking more time(TTFB - Time To First Byte is very high). Not sure what is going on. I have already gone through the Performance improvement suggestion page. But still I am not able to find what is wrong with the application. It stays very slow. I have already posted few threads in this group regarding this slowness.

    Also, I have no idea about profiling a python script. Please guide me to make my site more faster.

Jun Omae

unread,
Feb 5, 2020, 9:37:09 AM2/5/20
to trac-...@googlegroups.com
- Are you using what version of Trac?
- Please share configuration of Apache and Trac.
- Your time to first byte is how many seconds/minutes?
- Enable [trac] use_chunked_encoding option.

--
Jun Omae <jun...@gmail.com> (大前 潤)

Velu Narasimman

unread,
Feb 6, 2020, 1:32:41 AM2/6/20
to Trac Users
I am using Trac 1.0.15 version.
Apache 2.4.38 with modules like mpm_event etc.,
SVN/1.9.3,
OpenSSL/1.1.1a,
mod_wsgi/4.5.2,
Python/2.7.12


Apache configuration file or virtual host configuration will be similar to this in my previous question.

Time To First Byte(TTFB) for the first request after I restart my apache2 server would be like 17 - 25 or 35 sec. But next few requests will take 8 - 9 sec. Then it will take 3 - 5 sec normally.

Apart from all what I am facing is an extreme slowness. I want to understand what is causing this slowness but I don't know how to troubleshoot this. Please share me some thoughts.

Jun Omae

unread,
Feb 6, 2020, 1:46:04 AM2/6/20
to trac-...@googlegroups.com
- Please share your trac.ini
- How many repositories are you using
- Set empty to [trac] repository_sync_per_request option
- https://trac.edgewall.org/demo-1.0/wiki/TracIni#trac-section
- https://trac.edgewall.org/wiki/TracRepositoryAdmin#ExplicitSync
> --
> You received this message because you are subscribed to the Google Groups "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/bda5ab83-00e2-4a10-a7b2-da791a67bbf8%40googlegroups.com.

Jun Omae

unread,
Feb 6, 2020, 2:15:52 AM2/6/20
to trac-...@googlegroups.com
On Thu, Feb 6, 2020 at 3:32 PM Velu Narasimman <velava...@gmail.com> wrote:
> Apache configuration file or virtual host configuration will be similar to this in my previous question.

- Should specify processes=N with value greater than 1 to WSGIDaemonProcess
- Should specify process-group=NAME and application-group=%{GROUP} to
WSGIScriptAlias

See also https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIScriptAlias.html

After changing the configuration, confirm process-group and
application-group of mod_wsgi in System Information of /about page in
your Trac instance.

--- httpd.conf 2020-02-06 16:01:24.954556600 +0900
+++ httpd.conf 2020-02-06 16:04:22.484843000 +0900
@@ -11,8 +11,8 @@
Protocols h2 h2c http/1.1

# uat conf
- WSGIScriptAlias /auth /path/to/DJANGO/WSGI/file
- WSGIDaemonProcess uat user=www-data group=www-data threads=25
python-path=/path/to/DJANGO/environment/Sourcecode
+ WSGIScriptAlias /auth /path/to/DJANGO/WSGI/file process-group=uat
application-group=%{GLOBAL}
+ WSGIDaemonProcess uat user=www-data group=www-data processes=8
threads=25 python-path=/path/to/DJANGO/environment/Sourcecode
WSGIProcessGroup uat

SSLEngine on
@@ -38,9 +38,8 @@
Require all granted
</Directory>
#Trac instance configuration
- WSGIScriptAlias / /usr/share/trac/trac.wsgi
+ WSGIScriptAlias / /usr/share/trac/trac.wsgi process-group=uat
application-group=%{GLOBAL}
<Directory "/opt/TracProjects">
- WSGIApplicationGroup %{GLOBAL}
Options Indexes FollowSymLinks
Order allow,deny
Allow from all

Velu Narasimman

unread,
Feb 6, 2020, 2:22:32 AM2/6/20
to Trac Users

I have attached my ini file with this email. I have a lot of(1500+) projects and each has its repository.
> To unsubscribe from this group and stop receiving emails from it, send an email to trac-...@googlegroups.com.
trac.ini

Jun Omae

unread,
Feb 6, 2020, 2:36:10 AM2/6/20
to trac-...@googlegroups.com
On Thu, Feb 6, 2020 at 4:22 PM Velu Narasimman <velava...@gmail.com> wrote:
>
> I have attached my ini file with this email. I have a lot of(1500+) projects and each has its repository.
>
> On Thursday, February 6, 2020 at 12:16:04 PM UTC+5:30, Jun Omae wrote:
>>
>> - Please share your trac.ini
>> - How many repositories are you using
>> - Set empty to [trac] repository_sync_per_request option
>> - https://trac.edgewall.org/demo-1.0/wiki/TracIni#trac-section
>> - https://trac.edgewall.org/wiki/TracRepositoryAdmin#ExplicitSync

Thanks.

Please set empty string to [trac] repository_sync_per_request option
to disable synchronizing repositories per each request.

====
[trac]
repository_sync_per_request =
====

Velu Narasimman

unread,
Feb 6, 2020, 4:44:30 AM2/6/20
to Trac Users
/about page is overwritten in my project. I am seeing some static text about my project in this about page. How else can I confirm the process group and application group ?

Velu Narasimman

unread,
Feb 6, 2020, 5:25:09 AM2/6/20
to Trac Users
should it be,
use_chunked_encoding = true or use_chunked_encoding = enabled?

Jun Omae

unread,
Feb 6, 2020, 5:31:49 AM2/6/20
to trac-...@googlegroups.com
No. Please temporally disable overwriting the about page.

On Thu, Feb 6, 2020 at 6:44 PM Velu Narasimman <velava...@gmail.com> wrote:
>
> /about page is overwritten in my project. I am seeing some static text about my project in this about page. How else can I confirm the process group and application group ?

> should it be,
> use_chunked_encoding = true or use_chunked_encoding = enabled?

Both settings lead same results. You could confirm it via
Transfer-Encoding header without asking.

Velu Narasimman

unread,
Feb 10, 2020, 5:37:46 AM2/10/20
to Trac Users
I have disabled the overwritten part of about page and I found the WSGI configurations as shown in the image below.

system_information.png

Now, is this properly configured???

Jun Omae

unread,
Feb 10, 2020, 6:07:50 AM2/10/20
to trac-...@googlegroups.com
On Mon, Feb 10, 2020 at 7:37 PM Velu Narasimman <velava...@gmail.com> wrote:
>
> I have disabled the overwritten part of about page and I found the WSGI configurations as shown in the image below.
>
> Now, is this properly configured???

Maybe, yes.

WSGIProcessGroup should NOT be %{GLOBAL} in the page (%{GLOBAL} means
using context of the Apache child processes). See
https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIProcessGroup.html
Reply all
Reply to author
Forward
0 new messages