Jump to content

Recommended Posts

Hello,

I am truly stuck. I have a website I built for a client that has become quite successful: http://drydenwire.com

It is an independent news agency. The problem is, I built everything from scratch in Processwire and things were purring along until the traffic went up. Now, I keep getting these huge spikes which last about 15 seconds and cause all users to receive a 503 Error. I have created a public repo for review: https://github.com/scramlo/DrydenWire.com/tree/master and can answer any questions that may lead to an answer. I am willing to hire a more experienced developer if the community is unable to help me mine out this issue.

I have gone through the usage logs and know that all traffic is legitimate, I am not getting bombarded by a spam IP address or anything like that.

Thank you for any and all assistance as this client is getting frustrated and I would rather not lose them!!!

-Brian

Screen Shot 2017-04-14 at 10.39.25 PM.png

Screen Shot 2017-04-14 at 10.39.53 PM.png

 

Share this post


Link to post
Share on other sites

Welcome Brian,

There is a pro module you might be interested in that is designed for tracking performance and identifying bottlenecks: Profiler Pro

There's more info about it in the blog post that introduced it: https://processwire.com/blog/posts/a-look-at-the-new-profilerpro-module/

And with purchase comes support from the man himself. Ryan says:

Quote

I often find myself in the position of helping people locate and fix bottlenecks on websites and applications, and this tool is something I've always wished I had. While ProfilerPro is a tool to identify issues, the support board is dedicated to helping users analyze, fix and optimize performance issues. When you purchase ProfilerPro, you are purchasing a helpful support service with the ProcessWire core developer to help you use the tool and isolate and resolve bottlenecks.

Might be a fast way to resolve the problem.

  • Like 4

Share this post


Link to post
Share on other sites

At a quick glance, one thing you should look at is applying a limit to the selector in your search template. Search results like this could quickly become a problem, particularly if there was some kind of bot hitting the site: http://drydenwire.com/search/?query=a

  • Like 5

Share this post


Link to post
Share on other sites

While you say that it's legitimate traffic, what kind of traffic is it? What I'm wondering is what exactly happens during that spike: are there more requests to a specific feature than usual, etc.?

While a code review could definitely result in some ideas about what to optimise, usually the best and first thing you should do is properly analyse the data you have, i.e. your log files. Find out any abnormalities in the requests, see which requests were particularly slow (you should get this data from the web server logs), and see if the MySQL slow query log (if you have it enabled) contains any additional clues.

As an example, one site I help maintain recently got a lot of heavy traffic all of a sudden. Turns out it was a result of a campaign where each request included a similar GET param, and that in turn made the site skip cache. Note that I'm not saying that this has anything to do with your specific case; it's just something I couldn't tell from the amount of traffic alone, but it was really obvious once I took a closer look at Apache logs :)

On a related note, it could also be that this has nothing to do with the code itself. It could simply be that your server -- or server configuration -- is the bottleneck. That too could be a result of an increase in a specific type of request, so again taking a closer look at the logs is where I'd start from.

Edit: It seems that you're running an nginx reverse proxy in front of your site, but for every request I get a response header X-Proxy-Cache: MISS. Doesn't seem that this proxy is doing it's job too well if none of the requests are served from the cache. I'm not an expert on this particular topic, but in my opinion there's something fishy about your setup :)

  • Like 5

Share this post


Link to post
Share on other sites

One thing that might be relevant is image processing. Are there times when multiple images might be being resized at once, like when a feed changes or something?

Share this post


Link to post
Share on other sites

I would like to say "Thank You" to each of you for responding to my post. I am a novice part-time developer (I am a full-time pastor) and love PW. This has been a great learning experience.

I took the advice of several of you and installed a logging module. I was going to go with the profilerpro module but found the tracy debugger and thought I would give it a go. The logging is fantastic thus far.

Below is what I found during another "blackout"

DATE/TIME USER URL TEXT
33 seconds ago
2017-04-18 14:11:29
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
34 seconds ago
2017-04-18 14:11:28
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
35 seconds ago
2017-04-18 14:11:27
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
36 seconds ago
2017-04-18 14:11:26
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
37 seconds ago
2017-04-18 14:11:25
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
38 seconds ago
2017-04-18 14:11:24
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
39 seconds ago
2017-04-18 14:11:23
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
40 seconds ago
2017-04-18 14:11:22
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
42 seconds ago
2017-04-18 14:11:20
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
3 minutes ago
2017-04-18 14:09:11
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
3 minutes ago
2017-04-18 14:09:10
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
3 minutes ago
2017-04-18 14:09:09
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
3 minutes ago
2017-04-18 14:09:08
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
3 minutes ago
2017-04-18 14:09:07
- ? SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)

 

Which has sent me on a chase regarding that error. It seems to be the wait_timeout or max_allowed_packet variables need to be configured to allow for higher amounts of data. 

Now, this obviously does not solve what is causing the variables to exceed their size limitations, but it is a start.

My question now is, what is the significance of the "?" ? It's as if no page was being requested. 

I will keep Googling and awaiting replies.

In the meantime I will take the following suggestions from the community:

1. I will take a closer look at the profiler pro module

2. I will limit my search functionality to make sure that isn't the cause

3. I believe the cacheing issue was because in a last-ditch-effort I turned on the Google Pagespeed Apache module, which does some goofy stuff I don't understand. I already use ProCache so to eliminate variables and slim down my code-funk I turned off Google Pagespeed and that could get the cacheing working properly again.

4. DaveP I don't fully understand the question, but I DO have several images being resized. Although, I believe I have correctly set things up to only resize on the SAVE of the template instance, not dynamically on a page load. So I don't THINK that is the problem, although I am swimming in deep waters here.

  • Like 2

Share this post


Link to post
Share on other sites

Sorry for not being clearer. What I was trying to say was that if, say, you imported a news feed from an outside source at a specific time, or it was updated and new items added all at once, and all of a sudden you had several images being resized for use on the front page, then that might make for a bottleneck.

Whatever is causing the issue, let's try to dig a bit deeper. Would I be right in thinking that you are on the Legacy branch (2.8.n) of PW? That's the one where line 390 of /wire/core/WireDatabasePDO.php looks likeliest to trigger an error. It shouldn't make a difference, but you never know.

Do you have (or could you ask for) access to the mySQL slow query log? It might not help, but it's another thing to eliminate, especially now that we are looking to resolve a mySQL timeout error that the logs you've posted point to.

Depending on your hosting setup, it might not even be your site that is the root of the problem - someone else might be borking the db server for you and you see the symptoms!

  • Like 1

Share this post


Link to post
Share on other sites

Update: My hosting provider made the following modifications 

max_allowed_packet=16M -> 100M
wait_timeout=60 -> 300

Although, I still received errors after they bumped it up :/ 

Reply to DaveP: 

Ah, I understand. No, this web application does not pull in external XML or JSON. It is all original content, so that should not be an issue. Even the advertisements are uploaded by the client. 

I am using Processwire version 3.0.35.

I am not sure what the mySQL slow query log is? I can request it from my host (SiteGround), but I wonder if it something I can find under Apache CPanel?

I am running this web application on a cloud server with

  • 3 CPU Cores
  • CentOS
  • 5GB RAM
  • 40GB SSD

It isn't "dedicated" but it is supposed to load balance, so I don't think another site would be the problem.

As you have suggested I will ask for the "mySQL Slow Query Log" from the hosting provider and see what they can give me. Thank you for sticking with me through this.

----

More Information

I've been going through the raw server logs. This just occurred this morning and I am thinking maybe there is a problem? Can one of you tell me if this looks like legitimate requests? The reason I wasn't sure is that it looks like so many requests all in the same second. But, I also realize that on each page there may be multiple requests depending on how the template is set up. Please let me know if any of this looks fishy. This is the total "blackout" period when the server reported the following exception: 

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /wire/core/WireDatabasePDO.php line 390)
*** ISSUE BEGINS ***      Total time: 7 Seconds      ***I SORTED THESE BY IP ADDRESS*** 
141.8.132.37 - - [19/Apr/2017:08:41:37 -0500] "GET /site/assets/files/1084/x68748d_c42c5fe92b484ab3a34fba0ebadd7a73_mv2_thumbnailImage-800-400-1-1.jpg.pagespeed.ic.uvpGfH63dU.jpg HTTP/1.0" 404 17077 "-" "Mozilla/5.0 (compatible; YandexImages/3.0; +http://yandex.com/bots)"



162.72.69.38 - - [19/Apr/2017:08:41:14 -0500] "GET /site/assets/files/1018/dka.730x170.jpg%20alt=http://drydenwire.com/news/the-dan-king-agency/%20title=http://drydenwire.com/news/the-dan-king-agency// HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:14 -0500] "GET /site/assets/files/2380/tyler-milton-drydenwire.320x240.jpg%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:15 -0500] "GET /site/assets/files/2375/sean-duffy.320x240.png%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:16 -0500] "GET /site/assets/files/1018/17201224_1314142275320656_1582408838009383145_n-2.318x318.jpg%20alt=http://www.thebodyshopfitnesscenters.com// HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:16 -0500] "GET /site/assets/files/2369/screen_shot_2017-04-17_at_4_08_21_pm.320x240.png%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:16 -0500] "GET /site/assets/files/2374/april_2017-1.320x240.jpg%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:17 -0500] "GET /site/assets/files/1018/110c10_85136d1065d24f7dbc5b06be0044fc2c_mv2.125x125.png%20alt=110c10_85136d1065d24f7dbc5b06be0044fc2c_mv2.png%20title=110c10_85136d1065d24f7dbc5b06be0044fc2c_mv2.png/ HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/1018/110c10_85136d1065d24f7dbc5b06be0044fc2c_mv2.125x125.png%20alt=110c10_85136d1065d24f7dbc5b06be0044fc2c_mv2.png%20title=110c10_85136d1065d24f7dbc5b06be0044fc2c_mv2.png/ HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/1018/12x12-logo_small.318x318.jpg%20alt=http://www.lakeplace.com/offices/shell-lake/dave-mcnulty/ HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/1018/68748d_45fb6c8cc2dd431f8d458272529ddc5f_mv2-1-3_318x318.318x318.jpg%20alt=http://www.drydenwire.com/advertise// HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/1018/business5.730x170.jpg%20alt= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/1018/dka.730x170.jpg%20alt=http://drydenwire.com/news/the-dan-king-agency/%20title=http://drydenwire.com/news/the-dan-king-agency// HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/1018/oral_cancer1-1.350x350.jpg%20class=img-fluid%20title=greenvalleydentalcare.com.edit.officite.com/oral-health.html%20alt=greenvalleydentalcare.com.edit.officite.com/oral-health.html HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/2372/dakota_mulroy.320x240.jpg%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/2373/roost_logo_jpeg.320x240.jpg%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/2376/sact-dfs.320x240.jpg%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/2379/screen_shot_2017-04-18_at_2_18_05_pm.320x240.png%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:26 -0500] "GET /site/assets/files/2381/image00dd1_thumbnailimage-800-400-1-1_1.320x240.jpg%20title= HTTP/1.0" 404 36489 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"
162.72.69.38 - - [19/Apr/2017:08:41:27 -0500] "POST /api/json-articles/ HTTP/1.0" 302 17097 "http://drydenwire.com/" "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/57.0.2987.137 Mobile/14E304 Safari/602.1"



174.219.8.165 - - [19/Apr/2017:08:41:40 -0500] "GET /news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/ HTTP/1.0" 200 6091 "http://m.facebook.com" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E304[FBAN/FBIOS;FBAV/88.1.0.64.70;FBBV/55330959;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iOS;FBSV/10.3.1;FBSS/2;FBCR/Verizon;FBID/phone;FBLC/en_US;FBOP/5;FBRV/55506002]"

174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/1018/16427419_727170664155206_316199905395247334_n.350x350.png HTTP/1.0" 200 83637 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/1018/68748d_d5da25c6d4fa4f6d9706cd23b1ad0090_mv2_318x318_1.350x350.jpg HTTP/1.0" 200 17698 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/1018/68748d_f3877726651c43cdb583674290d3db34_mv2_318x318_1.350x350.jpg HTTP/1.0" 200 16279 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/1018/oral_cancer1-1.350x350.jpg HTTP/1.0" 200 22970 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/1018/screen_shot_2016-12-21_at_2_37_10_pm_318x318_1.350x350.png HTTP/1.0" 200 78702 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/2372/dakota_mulroy.75x75.jpg HTTP/1.0" 200 3262 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/2380/tyler-milton-drydenwire_thumbnailImage-800-400-1-1.jpg HTTP/1.0" 200 64480 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:38 -0500] "GET /site/assets/files/2380/tyler-milton-drydenwire-1.jpg HTTP/1.0" 200 463645 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:39 -0500] "GET /site/assets/files/2375/sean-duffy.75x75.png HTTP/1.0" 200 10264 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"
174.255.138.116 - - [19/Apr/2017:08:41:39 -0500] "GET /site/assets/files/2380/tyler-milton-drydenwire.75x75.jpg HTTP/1.0" 200 3914 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 [FBAN/FBIOS;FBAV/85.0.0.34.62;FBBV/53195005;FBDV/iPhone6,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.3.5;FBSS/2;FBCR/TFW;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]"



174.255.200.17 - - [19/Apr/2017:08:41:34 -0500] "GET /site/assets/files/1018/68748d_45fb6c8cc2dd431f8d458272529ddc5f_mv2-1-3_318x318.318x318.jpg HTTP/1.0" 200 23365 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (Linux; Android 5.1.1; A571VL Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/112.0.0.20.70;]"
174.255.200.17 - - [19/Apr/2017:08:41:36 -0500] "GET /site/assets/files/1018/68748d_d5da25c6d4fa4f6d9706cd23b1ad0090_mv2.318x318.jpg HTTP/1.0" 200 23913 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (Linux; Android 5.1.1; A571VL Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/112.0.0.20.70;]"
174.255.200.17 - - [19/Apr/2017:08:41:40 -0500] "GET /site/assets/files/1018/68748d_f3877726651c43cdb583674290d3db34_mv2.318x318.jpg HTTP/1.0" 200 20575 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (Linux; Android 5.1.1; A571VL Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/112.0.0.20.70;]"
174.255.200.17 - - [19/Apr/2017:08:41:41 -0500] "GET /site/assets/files/1018/110c10_a5c4dfdb9fdf4e8fbc9c8432622f7132_mv2.125x125.png HTTP/1.0" 200 22570 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (Linux; Android 5.1.1; A571VL Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/112.0.0.20.70;]"
174.255.200.17 - - [19/Apr/2017:08:41:41 -0500] "GET /site/assets/files/1018/17201224_1314142275320656_1582408838009383145_n-2.318x318.jpg HTTP/1.0" 200 45937 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (Linux; Android 5.1.1; A571VL Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/112.0.0.20.70;]"
174.255.200.17 - - [19/Apr/2017:08:41:41 -0500] "GET /site/assets/files/1018/68748d_0ea114e791db455fb6605ab23b862dd5_mv2.318x318.jpg HTTP/1.0" 200 33057 "http://drydenwire.com/news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/" "Mozilla/5.0 (Linux; Android 5.1.1; A571VL Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/112.0.0.20.70;]"



184.158.34.180 - - [19/Apr/2017:08:41:35 -0500] "GET /api/json-news HTTP/1.0" 200 - "http://drydenwire.com/" "Mozilla/5.0 (Linux; Android 4.4.4; SM-S820L Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36"
184.158.34.180 - - [19/Apr/2017:08:41:35 -0500] "GET /api/json-news/ HTTP/1.0" 301 - "http://drydenwire.com/" "Mozilla/5.0 (Linux; Android 4.4.4; SM-S820L Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36"
184.158.34.180 - - [19/Apr/2017:08:41:35 -0500] "POST /api/json-articles/ HTTP/1.0" 302 17097 "http://drydenwire.com/" "Mozilla/5.0 (Linux; Android 4.4.4; SM-S820L Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36"



24.178.47.197 - - [19/Apr/2017:08:41:38 -0500] "GET /news/shell-lake-man-charged-with-2nd-degree-sexual-assault-of-a-child/ HTTP/1.0" 200 6091 "http://m.facebook.com" "Mozilla/5.0 (iPad; CPU OS 10_1_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Mobile/14B100 [FBAN/FBIOS;FBAV/88.1.0.64.70;FBBV/55330959;FBDV/iPad4,2;FBMD/iPad;FBSN/iOS;FBSV/10.1.1;FBSS/2;FBCR/U.S.Cellular;FBID/tablet;FBLC/en_US;FBOP/5;FBRV/0]"



68.190.149.70 - - [19/Apr/2017:08:41:36 -0500] "GET /news/jury-trial-scheduled-for-man-charged-with-auto-theft-in-washburn-county/ HTTP/1.0" 200 5737 "http://m.facebook.com/" "Mozilla/5.0 (Linux; Android 7.0; SAMSUNG-SM-G930A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/119.0.0.23.70;]"
*** ISSUE ENDS ***

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Edited by Brian Scramlin

Share this post


Link to post
Share on other sites

Hello Brian.

Just saw only two files and here are small suggestions for better practice ( pages->find inside foreach and count inside for loops).

insider-home.php

// line 2.
foreach ($pages->find("articleInsider=1") as $article){
...
}

better is this:

$articles = $pages->find("articleInsider=1");
foreach ($articles as $article){
...
}

or

article.php

// 46. line
for ($i=0; $i < count($titleArr); $i++) {
    ...
}

to this

$c = count($titleArr);
for ($i=0; $i < $c; $i++) {
   ....
}

It's not problem if do this inside if statement eg. if( count($pages->find...) > 1 ).

Regards.

Share this post


Link to post
Share on other sites

These are such micro performance improvements, that I doubt these causing the cpu spikes.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By prestoav
      Hi everyone,
      PW version 3.0.123
      I've recently tried to upgrade the Blog module in an installation from 2.4.0 to 2.4.5 and now get the following errors when trying to visit Blog > Posts in admin:
      Fatal Error: Uncaught Error: Call to a member function count() on null in /MYSITE/site/modules/ProcessBlog/ProcessBlog.module:1299 Stack trace: #0 /MYSITE/site/modules/ProcessBlog/ProcessBlog.module(1421): ProcessWire\ProcessBlog->renderItemsSummaries(Object(ProcessWire\PageArray)) #1 /MYSITE/site/modules/ProcessBlog/ProcessBlog.module(1989): ProcessWire\ProcessBlog->renderItemsList(Object(ProcessWire\PageArray)) #2 /MYSITE/wire/core/Wire.php(380): ProcessWire\ProcessBlog->___executePosts() #3 /MYSITE/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___executePosts', Array) #4 /MYSITE/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessBlog), 'executePosts', Array) #5 /MYSITE/wire/core/ProcessController.php(333): ProcessWire\Wire->__call('executePosts', Array) #6 /MYSITE/wire/core/Wire.php(380): ProcessWire (line 1299 of /MYSITE/site/modules/ProcessBlog/ProcessBlog.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. I can see posts in Blog > Dashboard and all seems to work still on the front end.

      Anyone else seen this or know of a fix?
    • By jom
      Chäs & Co is a b2b cheese trader. They love good cheese and are proud of their excellent knowledge und connections to small cheese producers. They maintain a custom made database and used to copy/paste (!) the cheese infos to the former CMS (Contao). Since substituting the database with ProcessWire was no option, they export now the database to a csv file and import it to the new website (expanded version of module ImportPagesCSV).
      From there, the pw magic begins. The staff works with the admin interface: They search and find products in notime using the build-in search field (using cheese names or id. Using ids only possible by adding hook, see this forum thread). They generate price lists easily based on a template, providing checkboxes and option buttons for some restrictions, choose i.e. the cheese origin and price audience (all implemented as page selectors). By saving the page a PDF list gets generated (using mpdf, a php pdf library).
      The visitors can sort and filter the products using a form by shuffle.js. Product details are shown in a popup (fancybox). There's also the option for generating a nice pdf data sheet. No CSS framework being used.
      Other modules used: ProcessJumpLinks, ProcessProMailer, ProcessWireUpgrade.
      Visual design: Nicole Haller


    • By Juergen
      Hello @ all,
      I am creating a new inputfield/fieldtype to store opening hours, but I am struggeling to save values from multiple dynamic created inputfields in 1 column of the database.
      Scenario:
      The user can enter one or more opening times per day in a UI.
      Fe:
      Monday open from 08:00 to 12:00 and from 14:00 to 17:00 Tuesday open from 08:00 to 12:00 and from 14:00 to 19:00 and so on
      Via a little JavaScript you can add as much opening times as you need per day - the additional inputfield will be created dynamically.
      After form submission all the values are in the POST array -> this works (see example below):
      ProcessWire\WireInputData Object ( [openinghours_mo-0-start] => 09:00 [openinghours_mo-0-finish] => 13:00 [openinghours_mo-1-start] => 14:00 [openinghours_mo-1-finish] => 18:00 [openinghours_mo-2-start] => 21:00 [openinghours_mo-2-finish] => 23:00 [openinghours_tu-0-start] => 09:00 [openinghours_tu-0-finish] => 13:00 [openinghours_tu-1-start] => 14:00 [openinghours_tu-1-finish] => 18:00 [openinghours_we-0-start] => 09:00 [openinghours_we-0-finish] => 13:00 [openinghours_we-1-start] => 14:00 [openinghours_we-1-finish] => 18:00 [openinghours_th-0-start] => 09:00 [openinghours_th-0-finish] => 13:00 [openinghours_th-1-start] => 14:00 [openinghours_th-1-finish] => 18:00 [openinghours_fr-0-start] => 09:00 [openinghours_fr-0-finish] => 13:00 [openinghours_fr-1-start] => 14:00 [openinghours_fr-1-finish] => 18:00 [openinghours_sa-0-start] => [openinghours_sa-0-finish] => [openinghours_so-0-start] => [openinghours_so-0-finish] => ) The property name is always the name attribute of the field 😉 . If the property is empty means closed on that day.
      Now I need to combine all those values into 1 array (or json array) and store it in the database in 1 column called 'hours' in my case (see screenshot below):

      In my ___processInput(WireInputData $input) method I have tried to make it work like this:
      public function ___processInput(WireInputData $input): self { $name = $this->attr('name'); $value = $this->attr('value'); //input object includes always every input on the page, so lets filter out only inputs from this field //we need to do this, because the number of values is variable - so extract only values that starts with $name.'_' $nameAttributes = []; foreach($input as $key=>$value){ if(substr($key, 0, strlen($name.'_')) === $name.'_'){ $nameAttributes[$key] = $value; } } // loop through all inputfields of this fieldtype $time_values = []; foreach($nameAttributes as $nameAttr => $value) { $time_values[$nameAttr] = $value; } } //save it in the database $input->set('hours', serialize($time_values)); return $this; } The only important part of this code is the last part with the serialize function.
      After saving it will create a record in the database, but the value is always NULL (default value) (see below).

      Checking $time_values returns all the values, but printing out "$this" shows me that the property "hours" inside the Openinghours object is empty (see below) - so the mistake must be there, but I dont know where?!?!?!?
      [title] => Home [openinghours] => ProcessWire\OpeningHours Object ( [data] => Array ( [hours] => ) ) If I check the sleepValue() method or the sanitizeValue() - they are also empty. So it seems that the values will not reach these methods. I havent found a clear documentation of whats going on behind the saving process of an inputfield.
      As far as I know the saving process starts with the form submission. The values are in the POST array and will be processed by the processInput() method. Before they will be saved in the database they will be sanitized by the sanitizeValue() mehtod and afterwards they will be prepared for storage in the sleepValue() method.  The last step is the storage itself.
      Has someone an idea what is missing by storing values from multiple fields into 1 database column or has someone a working example of such a scenario on github to help me out.
      A clear explanation of the storage process will be also helpful.
      Thanks and best regards
    • By Pip
      Hi Everyone 
      I've been working on Processwire for two months now. Structuring the website as needed. Unsure why but I'm getting this one now. Seems my fields has crashed. 
      I've tried googling some answers but can't seem to find a step by step guide on how to rectify this. Any advise? Practically new on this. 
      TIA. 

    • By Rodd
      Hi everyone!
      I have a website in a production environment and I want to duplicate it in a local environment. I exported the content of the website (with the 'Site Profile Exporter' module) but I cannot use it actually. I've got an issue with the database. I imported this one in MAMP then.

      I also exported the pages (with the 'ProcessPagesExportImport' module), but I cannot import it to my local website because the fields don't exist. So I created this fields, but I have this error :
      How can I use the elements that already exist and are presents in my database? How can I duplicate correctly the templates, fields and pages?
      Thanks by advance
      PS: Sorry if my english is bad
       
×
×
  • Create New...