DataTables Very Slow, Please Help!

DataTables Very Slow, Please Help!

powerongrfxpowerongrfx Posts: 5Questions: 0Answers: 0
edited April 2014 in General
I been having an issue with DataTables being slow on my website for about a year. Finally getting down to the issue but can't figure it out. DataTables is implanted with a plugin called WordPress Download Manager. I'm executing the tables with a short code on my page called browse which I offer for my registered members.

Sometimes it loads with no huge wait but most of the times the page takes 5 minutes to load or the website times out when you try to access the page with DataTables. The platform im using is WordPress and it's updated to the most current version. After speaking with WordPress Download Manager they pretty much said that its the DataTables and they can't do to much for me since it's not a error in there plugin.

I went ahead and found the .js file which lead me to this site since the copyrights was listed on the file. I found the FAQ and tried bSortClasses and bDeferRender but no luck the same thing. Im kinda at a standstill with my website since members complain about this issue since they can't access files using DataTables.

Im currently running a high end dedicated server thats blazing fast. What are my options? Can I hire a freelancer to do this for me?

Maybe server side processing my be the way? Really new to all of this spent two days straight reading on DataTables. I listed below the page where DataTables is located.

http://acapelladjs.com/browse-plus/

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited April 2014
    You're right - that is very slow!
    1. How many records (rows) are you trying to load?
    2. server side processing could be the way forward.
    3. Allan offers paid support: http://datatables.net/support
  • jan_goyvaertsjan_goyvaerts Posts: 31Questions: 0Answers: 0
    Have you checked the TimeLine in Chrome ? They have included very good development tools into this browser !

    The YSlow browser plugin might be worth a shot.
  • powerongrfxpowerongrfx Posts: 5Questions: 0Answers: 0
    @tangerine
    1. There is about 2240 songs. It will continue to grow.
    2. Im all for it as long no issues arise from this.
    3. Is this to answer questions? Or he will actually edit DataTables and fix the issue?

    @jan_goyvaerts
    Points to the Datatables as the issue.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I've just fired it up in Chrome and the HTML page is 1.8MB and takes 21 seconds to download. You are using the unminified version of DataTales and that is taking 5 seconds to load - at 380K that is a horribly slow connection - but you should use the minified version.

    Once the page is actually up, the initialisation of DataTables appears to happen very quickly for me.

    I'm not seeing 5 minutes load time in Chrome! Is it only in some browsers?

    Allan
  • ThefinaleofseemThefinaleofseem Posts: 11Questions: 0Answers: 0
    edited April 2014
    2240 records isn't that much. You should be seeing better performance. How many columns do you have in that table? You say songs. Probably a silly question, but are you loading the songs themselves inside the table as it loads instead of loading them individually on demand?

    I had an issue with sluggish tables, albeit not this bad. One thing that helped was making sure that only plain text was returned from the sort and filter operations wherever possible. Datatables builds the search/filter array when loading the table and has to process everything. Plain text is much easier to process than lots of HTML or other elements, which have to be diced up and scrutinized.

    You say it points to Datatables as the issue. If you haven't already, try using the full, non-minified version of Datatables, jQuery, etc (only for the test, of course!) and run those tools again. Chrome has great ones, but I myself am more familiar with Firefox. Firebug is handy for showing requests/responses and time taken on each, and FF has a good Javascript profiler that I found very helpful in finding specific bottlenecks in the code. Perhaps Datatables is the issue, but it's always helpful to know what piece or area is bogging down in Datatables.
  • powerongrfxpowerongrfx Posts: 5Questions: 0Answers: 0
    edited April 2014
    Hey,

    Appreciate the quick response allan. Sometimes it loads up after 21 - 30 seconds. Other times for a bunch of users they claim that the page stays stuck in a loading loop. Regarding the minified version how do I go about doing this? You are correct once it loads up the datatables work perfect with no slow effects. The big issue is loading the page and getting to datatables.

    Could be different browsers in Internet Explorer took about one minute. I'm using Google Chrome and those random issues from time to time as explained above.

    Thank You,
    Anthony
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    I should have mentioned that I used Firefox to take a look. It looked like taking forever - I gave up after about 30 seconds.
    However - I just looked again (still Firefox) and got reasonable response time. I've never encountered anything in DataTables which could cause such inconsistency.
    I'm no expert, but looking at "view page source" you seem to have a lot of complexity which might not all be necessary. Your basic application seems quite straightforward, but you're loading a lot of extras. And as Thefinaleofseem says, you don't really have a lot of data as databases go.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I agree with the others - I don't believe that DataTables itself is at fault here. It looks like latency in the requests being replied to by the server. What is the load on your server?

    Allan
  • powerongrfxpowerongrfx Posts: 5Questions: 0Answers: 0
    @Thefinaleofseem
    I currently have 5 columns at the moment. Im not sure regarding loading the song on the table. Could be but the rest of the website loads pretty fast. It's just this page with the Datatables being displayed that takes forever. Most users will just leave and assume its not working.

    @tangerine
    Thats what most users do they wait a minute and leave the page since it stays stuck in loading.

    @allan
    When I went to click on the page with Datatables it stood loading for about 1 - 2 minutes for me. During this time I went to server side and watch process manager. Shows the process of my website index.php and cpu% at 4.0 and after the page loaded the process went away. Also seems like after it loads once for a session on user side you can return to datatable page and it loads quick. It's the first load seems to be the big wait. Without this being processed my server load sits at Load Averages: 0.01 0.08 0.10

    Thank you
  • powerongrfxpowerongrfx Posts: 5Questions: 0Answers: 0
    Also had a couple people access the page that datatables is located. During this time on process from server shows /usr/bin/php /home/acapella/public_html/index.php and looks like it opens it for each user.

    They claim that it took 45 seconds to 1 minute and they ended up closing the browser since it look liked it did not work. So once they reopen they waited 15 seconds or so and it loaded up. Once it loaded up the datatables the first time loaded every time after that instantly.

    Thanx
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    That's an impressively low load average - nice! So that's not the issue then...

    I've just tried it in Chrome with an empty cache ad the loading of the HTML for the page takes 51 seconds. That's nothing to do with DataTables, that's just transmission of data. The DOM ready event is firing about 1 minute 5 seconds after the initial page request - at that point DataTables can initialise the table, which it appears to do reasonably quickly (you could add a bit of Javascript to check exactly how fast).

    However, as I say, DataTables can't actually do anything until the DOM is ready. And at 1 minute to load the page, folks are going to give up for certain!

    Are you able to put up a copy of the page without DataTables on it?

    What kind of connection is the server on? 50 seconds for 1.8MB of data is terrible! I'm on a 80MB/s downlink here and I seem to be getting around that at times, so I don't think it is my downlink, particularly as others are seeing a poor connection speed as well.

    The other thing is that 1.8MB of data is a lot for an initial page load - certainly mobile users won't thank you for it! You should look at reducing that as much as you can. For example you have loads of repeating inline styles:

    > Register!

    Most of that is completely redundant! Just use a class and put the style into your CSS!! You should be able to get the table size well down below 1MB I would suggest.

    Allan
This discussion has been closed.