Analyzing Discourse Performance using NGINX logs

(Sander Datema) #21

Just as a heads up: I’m still having this problem as well.

(ljpp) #22
Top 30 not found urls (404s)

Url                                                                              Count
---                                                                              -----
GET /uploads/favicon/favicon.ico HTTP/1.1                                          388 
GET /uploads/favicon/manifest.json HTTP/1.1

Background: I created a folder for favicons under uploads. Then I use a favicon generator to generate a bunch of favicons and a complete declaration HTML:

The favicon seems to work, but it puzzles me why the .ico & .json appear as 404? The .PNG files work.

Discourse 1.5 beta branch and Docker setup.

(Sam) #23

Question about something I’m seeing in reports:

Over the past week my instance has been having some sporadic performance issues, which appears to coincide with significantly larger than normal Anonymous entries in the NGINX reports.

e.g., normal day:

Top 30 users by Server Load

Username    Duration Reqs Routes                                                                          
--------    -------- ---- ------                                                                          

[Anonymous]   646.15 2862 topics/show(252.48) categories/index(204.90) -(60.69) user_avatars/show(34.32)   
Top 100 routes by Server Load

Route                                   Duration Reqs  Mobile      
-----                                   -------- ----  ------      
topics/show                               408.92  1464  136 (9.29)% 
categories/index                          351.09   637   45 (7.06)% 
user_avatars/show                         164.52  2470 426 (17.25)% 
topics/timings (POST)                     128.37  2581 655 (25.38)% 
list/latest                                73.90   358  52 (14.53)% 
-                                          60.69   635  68 (10.71)% 
- (POST)                                    0.27    27   3 (11.11)% 

But yesterday, when we were having some issues:

Top 30 users by Server Load

Username    Duration Reqs Routes                                                                          
--------    -------- ---- ------                                                                          

[Anonymous] 11747.63 9557 - (POST)(5430.92) -(5104.66) topics/show(609.38) categories/index(256.95)        
Top 100 routes by Server Load

Route                                Duration Reqs  Mobile      
-----                                -------- ----  ------      
- (POST)                              5430.92  6576    3 (0.05)% 
-                                     5104.66   609   45 (7.39)% 
user_avatars/show                      764.95  2279 353 (15.49)% 
topics/timings (POST)                  761.55  1791  153 (8.54)% 
topics/show                            750.75  1386 175 (12.63)% 
draft/update (POST)                    441.09   508    5 (0.98)% 
categories/index                       426.02   341   26 (7.62)% 
list/latest                            206.17   464  53 (11.42)% 

Am I making a bad assumption when I think this is probably not valuable traffic? Some sort of bot or whatnot? Haven’t had an increase any new users or anything, a little more (maybe ~10%) more usage from actual members over the past couple weeks.

It’s just really annoying, our setup is fine for our normal and even our high activity levels, but it hasn’t been holding up well over the past week.

(Rafael dos Santos Silva) #24

Hey, first of all I really love this feature, well done! :heart:

But this log leaks api_keys to moderators, if an api_key request gets to the “Top 30 urls by Server Load”, since the topic sits at the staff category.

(Alan Tan) #25

This is implemented in


Mmh, is it just me or has the nginx-log changed? My site sends the request correctly, it wouldn’t work otherwise:

GET /latest.json?api_key=xxxAPI_KEYxxx&api_username=anonymous

But since some older 1.7 beta (3?) the api_key is leaked again because the order is different (according to the performance report):

GET /latest.json?xxxAPI_KEYxxx=[FILTERED]&api_username=anonymous

(Jeff Atwood) #27

Hmm you should look into this @tgxworld

(Alan Tan) #28

Thanks for reporting.

One of the commits I pushed broke it :frowning:

(Ильинский) #29

I accidentally deleted Staff category. Where the bot will post logs?

(Daniela) #30

You can’t if you are not be able to create a new category_staff_id via rails C.
Unfortunately my systeam is not familiar with ruby ​​on rails commands as he knows docker, but if you find a solution please, share it.

For references:

(Michał Frąckiewicz) #31

I tried to use nginx_analyze.rb script to analize strange traffic to my v1.8.0.beta11 forum but didn’t find it in /var/www/discourse/script after ./launcher enter app.
It was moved somewhere or removed?

(Alan Tan) #32

The nginx analyzer was moved into a plugin. I’ve updated the OP so you can find the updated path there.

(Michał Frąckiewicz) #33

Ok, it works. Thanks :slight_smile:

(Christoph) #34

I’m running the container behind an outer NGINX reverse proxy and I cannot seem to get the above type listing of server load by IP. When I link the container via unix socket, I get this:

Top 30 IPs by Server Load

IP Address Duration Reqs
---------- -------- ----
unix:        127.97 1239 

And when I do it via TCP/IP, I get this:

Top 30 IPs by Server Load

IP Address Duration Reqs
---------- -------- ----  166.27 1712 

Since that IP is a private IP, the latter probably has something to do with my VPS provider has set things up, but is it by design that the unix socket eats the client IPs?

(Roman Burdakov) #35

Hi there. I’m trying to enable performance reports for Discourse SaaS installed from Amazon Marketplace. First of all, I don’t see launcher anywhere on the server, thus I can perform:
cd /var/discourse
./launcher rebuild app

/opt/bitnami/ seems to be closest to launcher, but it is missing rebuild, enter commands.

Can someone provide alternative instructions for SaaS offering? Thanks.

(Jeff Atwood) #36

We only support the Docker based installs here, sorry!

(James Mc Mahon) #37

Bitnami is great for many things, but they don’t update their images often enough to be able to keep up with Discourse (and docker) updates. As a result you’re really on your own as far as support and maintenance is concerned. I learned this the hard way myself.

While I know this is not ideal, I’d recommend you move your installation to one that’s supported by the Discourse community. You can find suitable hosting here, here or here, build a clean image, install docker, install discourse and import the existing community via the discourse backup/restore function.

It’ll be worth it in the long run.

The cheapest solution for hosting?