With Jquery dataTable, but there is too much data on the page, loading the page will prompt stop plugin. How to improve efficiency.

  question

The framework used is symfony, twig.
There are about 6000 pieces of data on the page that need to be realized. I use dataTable to page and query all the data after loading.
However, it will obviously get stuck during loading and occasionally jump out of the confirmation window of whether busy continue or stop script.

图片描述

Memory usage is about 67MB.

图片描述

This is background code

public function indexAction()
 bracket
 $em = $this->getDoctrine()->getManager();
 $qb = $em->createQueryBuilder();
 $qb->select('p.id, p.name as pname, wave.name as wname')
 ->from('AlbatrossAceBundle:Project', 'p')
 ->leftJoin('p.customwave', 'wave');
 $result = $qb->getQuery()->getArrayResult();
 
 return $this->render('AlbatrossAceBundle:Project:index.html.twig', array(
 'entities' => $result,
 ));
 bracket

This is my dataTable configuration

<script type="text/javascript">
 $(function () {
 $('#data-table').dataTable({
 "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
 "bFilter": true,
 "aaSorting": [[0, 'desc']],
 "iDisplayLength": 20
 });
 $('#data-table_filter').css('display', 'block');
 });
 </script>

I don’t want to paginate in the background. I like front-end pagination and query very much. How can I improve the efficiency?

Thank you.

Backend paging is recommended.

The 6,000 pieces of data are too large for both the front end and the back end. This is not a question that you like or dislike. It is a question that you can or cannot do. The answer is also very simple and you cannot do it.

If there are 6,000 pieces of data to be processed with js, writing native js may improve some efficiency. If the speed of js engine is increased by 10 times at present, the front end is OK, and such a large amount of data at the back end will directly bring down the database when single digits are concurrent.

Writing code is for solving problems, not for personal enjoyment.

Loading 6,000 pieces of data at one time and paging at the front end is not against best practices, but fundamentally a wrong design.