• I am using WP to Twitter on a photo blog site.

    The plugin generally works very well but is causing very high spikes in CPU usage when I publish a post.

    I have verified this by carrying out tests and viewing real time CPU load when publishing a post.

    My web host thinks I should remove this plugin and says they have seen similar problems with other sites using it.

    I don’t wish to remove it as I like the plugin. I also like the web host and don’t wish to move the site elswhere, although I will if I have to.

    How much memory should this plugin be using?

    Les Bell

    https://www.ads-software.com/plugins/wp-to-twitter/

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    Not much, generally speaking. I could imagine that if there are problems in cURL on your server causing long execution times of the remote requests to Twitter, that could cause excess CPU load. Are you having long execution times when publishing? Do you have any information about where the delay is happening?

    Thread Starter lesbell

    (@lesbell)

    Hi Joe,

    Thanks for your reply. When I publish a post there is virtually no delay and the post is sent to Twitter straight away.

    I always check immediately afterwords and the post is there.

    But, what is happening is that at the time of publishing a post a CPU load spike occurs to over 100% and that sometimes causes a problem.

    Les Bell

    Thread Starter lesbell

    (@lesbell)

    Hi Joe,

    Do you think you could clarify “not much” please, so I can confidently know how much resources the plugin should be using.

    Les Bell

    Thread Starter lesbell

    (@lesbell)

    Hi Joe,

    I contacted my web host who have checked their systems and say there are no problems with cURL on the server.

    Les Bell

    Plugin Author Joe Dolson

    (@joedolson)

    The amount of CPU it *should* use is insignificant. (By which I mean it should use an insignificant amount of CPU.)

    However, there are a lot of possibilities relating to your site in specific that could make a difference.

    1) Are your Tweets long? E.g., are they likely to be long enough that they usually require the truncation routines to run and remove part of the Tweet?

    2) Does your server have the Normalizer class available in PHP, or is WP to Twitter using it’s own fallback class?

    3) Are you using WP to Twitter alone, or is it with the WP Tweets PRO add-on? (There are processes only run in the Pro version, so I need to know this. However, if you are running WP Tweets PRO, we’ll need to take this support process out of www.ads-software.com, as I can’t provide support for premium plug-ins on the www.ads-software.com forums.)

    4) Do you have a very large number of posts (including attachments) on your site?

    5) Is your WP to Twitter install in debugging mode? (This would be very unlikely, unless you turned it on by editing the code. Check by looking at the code of wp-to-twitter.php line 32)

    Thread Starter lesbell

    (@lesbell)

    Thanks for your reply.

    Here are my answers to your questions:

    1) Tweets are never more than 140 characters and a photo – average maximum file size 300kb – I have tested with only a few words of text and no photo and same amount of resources are used.

    2) Not sure if server has Normalizer class available in PHP – I’ll check that.

    3) I am using WP to Twitter alone.

    4) Site currently has 86 posts.

    5) WP to Twitter is not in debugging mode

    Thread Starter lesbell

    (@lesbell)

    Hi Joe,

    Server has Normalizer class available in PHP

    Plugin Author Joe Dolson

    (@joedolson)

    Hmm. No clues there, then.

    Do you add the photo to your Tweet? How do you add that – by adding the URL for the image to the Tweet, or by using Twitter Cards to show them?

    Thread Starter lesbell

    (@lesbell)

    Hi Joe,

    I make a new post in WordPress with the photo and caption text below it.

    Then I just hit the publish button and it gets added to website and sent to Twitter. That’s when the CPU spike occurs.

    Plugin Author Joe Dolson

    (@joedolson)

    When you do that, does the image end up in your Tweet? Can you send me a link to a Tweet with an image?

    Thread Starter lesbell

    (@lesbell)

    Yes, the image is in the Tweet – here is a random example:

    https://twitter.com/LJB_Les/status/698956326966317057

    Plugin Author Joe Dolson

    (@joedolson)

    OK. That’s a Twitter Card, so it’s not responsible. Uploading an image to Twitter could be an expensive operation, but it’s not something that you’re doing. So, again, no clues there.

    I wonder if it’s a plug-in conflict – something caused because of a second plug-in causing a loop. Can you provide a list of your active plug-ins & versions?

    Thread Starter lesbell

    (@lesbell)

    Here is a screenshot of plugins in use:

    https://awesomescreenshot.com/0fd5o3n6a2

    I’ve tried it with all plugins disabled except your’s and CPU spike still happens.

    Thread Starter lesbell

    (@lesbell)

    Here is a screenshot video of the CPU spike:

    Increases when I hit the publish button and then goes red and off the scale. Drops right back down again after that.

    Plugin Author Joe Dolson

    (@joedolson)

    I’ve done some of my own testing to monitor CPU spikes, and haven’t been able to produce this. The fact is that WP to Twitter doesn’t do all that much during this process – it saves some meta data, parses your post info into a Tweet based on your templated format, then pushes the Tweet to Twitter. It uses the options API, post meta API, transients API, and WP_HTTP API to do these.

    Does your database need optimizing? If there are long write and read times to the database, maybe that’s an issue?

    I honestly have no idea why this would be generating such a CPU issue for you – I can’t find something which seems like a probable candidate, and since I can’t reproduce this, I can’t really hunt it down effectively.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘WP to Twitter Causing Excessive CPU spikes’ is closed to new replies.