How to get around "Resource Limit Is Reached" error, without breaking rules

rejectli

New Member
Messages
25
Reaction score
0
Points
1
If you get the following error on your website then this might help.

Resource Limit Is Reached
The website is temporarily unable to service your request as it exceeded resource limit. Please try again later.​

This can happen if your webpage has a lot of small images that flood x10hosting with resource requests when the page is loaded. The result is that your images load (or fail to load) randomly.

I've been working on a way to solve this problem at the client side and so far have created this example. I did want to define the coordinates in the same line as an <img> tag but drawImage seems to only work with <canvas> and <canvas> does not have an onload() event. Maybe someone else can make it better.

<!DOCTYPE html>
<html>
<body>

<p>This page only loads one image.</p>

<table>
<tr>
<td><canvas id="c1"/></td>
<td><canvas id="c2"/></td>
<td><canvas id="c3"/></td>
<td><canvas id="c4"/></td>
</tr>
<tr>
<td><canvas id="c5"/</td>
<td><canvas id="c6"/</td>
<td><canvas id="c7"/</td>
<td><canvas id="c8"/</td>
</tr>
</table>

<script>
window.onload = function() {
(img = new Image()).src =
"http://68.media.tumblr.com/1dee464f3179885291f003d73db09f6d/tumblr_ndnl78QUvS1r5vojso5_500.jpg";
document.getElementById("c1").getContext("2d").drawImage(img, 0, 0, 166, 155, 0, 0, 166, 155);
document.getElementById("c2").getContext("2d").drawImage(img, 167, 0, 166, 155, 0, 0, 166, 155);
document.getElementById("c3").getContext("2d").drawImage(img, 334, 0, 166, 155, 0, 0, 166, 155);
document.getElementById("c4").getContext("2d").drawImage(img, 0, 158, 166, 155, 0, 0, 166, 155);
document.getElementById("c5").getContext("2d").drawImage(img, 167, 158, 166, 155, 0, 0, 166, 155);
document.getElementById("c6").getContext("2d").drawImage(img, 334, 158, 166, 155, 0, 0, 166, 155);
document.getElementById("c7").getContext("2d").drawImage(img, 0, 313, 166, 155, 0, 0, 166, 155);
document.getElementById("c8").getContext("2d").drawImage(img, 167, 313, 166, 155, 0, 0, 166, 155);
};
</script>

</body>
</html>​
 

rejectli

New Member
Messages
25
Reaction score
0
Points
1
Ok, have managed to incorporate much better code into Docuwiki with the help of some plugins. It actually reduces the size of the text you need to edit!

The code above has some errors anyway. Forget it.

I refuse to believe that nobody else has faced this problem. All you need to do to replicate it is make an account with x10hosting. Set it to use Docuwiki as template. Edit a page. Put on 5 images and some text. You'll get the error. Surely this can't be right, you'd think. Surely x10hosting can cope with 5 images and some text?!?

Even Docuwiki without any content at all sometimes fails to load. Why x10hosting put Docuwiki as a template when it doesn't work with x10hosting's resource limitations I don't know. But I've fixed it and two days ago I didn't even know how to use JQuery. Where there's a will there's a way. I don't think x10hosting actually tested Dokuwiki worked as a template. They just plonked it on, probably ran it once, saw it looked ok and assumed that was it.

I'll post a tutorial under a better heading as this thread is poor.

As an aside I noticed that the Dokuwiki implementation is throwing a lot of unseen errors from the basic interface. All NetworkError: 508 Unknown errors. So basically, the Dokuwiki fetch.php is trying like mad to get x10hosting to serve content but a lot of the time is being refused. This is something x10hosting should have noticed when they implemented the Dokuwiki template. I don't know how to debug JQuery yet (just barely learnt how to make an alert). This is something x10hosting should be fixing as why add a template to base an account on if the starting implementation is full of bugs?
 
Top