Support » Plugin: Code Embed » Works Fine but floods the server till it breaks

  • Hi,
    I am creating a website for reading books and articles online. I have the material saved as html files, so I am using the plugin to embed these html files into the posts, instead of copying and pasting the material again.

    The plugin works fine, but i recently noticed that my dedicated server keeps crashing. I contacted the server support. this is what they said:
    the biggest things I see being accessed are .html pages…As it seems requests are just flooding in for this…
    It seems you are having something that very rapidly tries to load all these html based pages. I do not know if it is bad code, or an attack, or outside sources that no longer have the proper URL. You will need to talk to your developer about that.

    My question is: is there a setting that i can change o slow down the plugin from requesting the html files?
    I only have 13 posts on a dedicated server, and it keeps hitting the php connections limit due to requesting the html files.
    is there anything that can be done in the plugin to optimize this?
    thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author David Artiss

    (@dartiss)

    Hi @coptic-treasures,

    It would help if you could tell me how you’re using the plugin. What code are you embedding and on what pages, for example?

    All this plugin does is add any scripts you provide into the page. If these are somehow overloading your server then it’s likely to be those scripts.

    Do you have a link to a page where this is happening?

    Hi @dartiss,
    I am embeding plain html files, not scripts.
    all what I do is i have some html files like this:
    https://texts.coptic-treasures.com/wp-content/uploads/html/deacons/hossam-kamal/alqms-fylwthaes-ebrahym-albghdady-hussam-kamal.html

    i put a % before it and after it, like this:

    %https://texts.coptic-treasures.com/wp-content/uploads/html/deacons/hossam-kamal/alqms-fylwthaes-ebrahym-albghdady-hussam-kamal.html%

    The problem is that one of the posts had 21 html files done like this, but there was an error in the url, so the files were “not found”.
    the moment this post gets published, the plugin will keep requesting the files till it drives the dedicated server out of memory and crashes the server.

    then what i have to do is to log in using ftp, rename the plugin folder to deactivate it, then re-gain control on the website.
    so I am asking why does the plugin keep requesting files till it crashed the memory?
    There should be a mechanism to prevent this behaviour, i hope.

    here is a post that contains the above url, which works perfect.
    https://texts.coptic-treasures.com/alqms-fylwthaes-ebrahym-albghdady-hussam-kamal/

    i can’t give you the url of the post that has errors, becasue if i published the post, it will crah the server.

    thanks

    Plugin Author David Artiss

    (@dartiss)

    Hi @coptic-treasures,

    Okay, I’ve taken a look at my code and, in the case of being unable to retrieve the script, it shouldn’t re-try. It tries to get the header first (so not even the full HTML) and, if that fails, it should just display an error. If it works it then goes and fetches the whole file.

    I’ll admit, the code around this could be better so, next release, I’ll tidy this up.

    However, fetching in the code from an external source, let along 21 times on a page, is always going to be an inefficient method of doing this – I would strongly suggest looking at better ways to do this – e.g. why not add the HTML code into the custom fields, so it’s not fetching externally?

    Hello @dartiss,
    thanks a lot for the update.
    1- I researched a lot, and your plugin is the best option for my project. I really can’t live without it. it is a great plugin.
    .
    2- I don’t load 21 files at once. these are book chapters, placed in a paginated post. so when i have more than one chapter, I put the <!--nextpage--> between them so the user only loads one page at a time.
    .
    3- I do not put a header in the html files I create, so the WordPress post itself does not load 2 headers (one for the post and one for the html file), is this correct? or do I need a header?
    .
    4- Do you mean I copy and paste the html code inside a custom field? this is very difficult for me as the books are huge and the browsers freeze sometimes from the log texts.
    .
    5- I am happy to pay and have the fixes and enhancement to the plugin as a paid exercise. Would you be interested to enhance the plugin on paid basis? this project is important for me and your plugin is irreplaceable.
    thanks a lot.

    Plugin Author David Artiss

    (@dartiss)

    Hi @coptic-treasures,

    Although the change I mentioned would make it a bit more efficient I don’t think it will resolve your issues, which is simply down to the way that you’re using it – the plugin was more envisaged as a way for people to add small script snippets without the editor baulking at them.

    I do this in my spare time so the change will happen… when it does. As for paying me, that is not an option (check my bio and you should understand why).

    So, let’s go back to the original issue. Why are you doing it this way? i.e. embedding the HTML for each page? Why do you not put this code into your post with the <!--nextpage--> separators between them? HTML can be added to the standard editor without a problem – the plugin was more to help those trying to add JavaScript – so I don’t understand the reason why you’re using it the way you are. If you could explain this to me a little more I may be able to suggest a better solution for you.

    Hi @dartiss,
    thanks a lot for your generous help. I really appreciate that you are taking the time to help me.
    the reasons I am doing so are:
    1- I am building a website with thousands of books, each has multiple chapters.
    When I try to paste the whole book, even with pagination, the WordPress post freezes in the backend. (take for example the commentary on the Bible Book of Genesis. Genesis is 50 chapters, each chapters can take tens of pages).
    .
    2- some authors review their books, handling the posts with large text lead to freezing of wordpress backend. I tried the WP desktop app, still same results nearly.
    .
    3- if I put the text in the wordpress content area, the database size will expand exponentially, but with the oembed method, i can have millions of html files, without expanding the database.
    .
    4- if i put every chapter as a separate post, I can’t put a table of content using table of contents plugin like “Creative Minds Table of Contents Plugin”, which I paid for their developers to get it to work with pagination and oembed.
    .
    5- also, more posts means more taxonomy to be able to connect the posts.
    .
    6- I tried adding the text to the database (or a new database using phpmyadmin), then show the text using a “mysql table plugin”. It worked, but it is not a practical solution, as my team needs to learn phpmyadmin.
    .
    I am not insisting on using the plugin if it is not the suitable option, but I ran out of ideas.
    I appreciate all help you can provide me with .
    Thanks in advance.

    Plugin Author David Artiss

    (@dartiss)

    Looking at your site the pages don’t appear particularly long. What I don’t know is how WordPress fetches long pages when split the way you’ve done them – one page may be displayed but it may be fetching the entire contents. I don’t know if splitting the individual sections into their own posts would help.

    However, even when looking at those specific pages, your site is slow. That may be due to the fact that you’re the opposite site of the world to me (or, at least, your site is hosted there), but you’re using Cloudflare as a CDN so I’d expect better. Even so, running out of memory and vague details from your host, is concerning.

    Slowness may occur by using my plugin to fetch the content externally but it WON’T fill the memory any more than doing this without it. The fact that you’ve tried to embed direct in the post and have similar problems would suggest this is a general WordPress and/or hosting issue here. You also say you don’t want to put in the post because of it expanding your database – that shouldn’t be a concern (unless your host limits your database size). WordPress hosts massive sites with all posts in the database. Indeed, WordPress.com runs on a single installation of WordPress, with a shared database, and hosts… well, let’s just say a LOT of sites. Database size is only an issue for your hosting, not WordPress itself.

    I really can’t suggest much else here. As I say, it’s not a plugin issue if it’s memory exhaustion. The output pages are not particularly big but if WordPress is loading all 21 HTML files at the same time (and they’re quite big), these will be put into memory and may cause you problems. The best bet is to split this out to separate pages. There are plenty of plugins around that will then help with navigation between these pages.

    Good luck with your answer!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.