GSOC 2013 - Server side pagination and Sorting

Content

Identify


Project summary

         MifosX follows the principle of Multitenancy, where a single instance of the application runs on the server serving multiple clients. When the user base gets very large and grows rapidly performance becomes a critical factor. 

Currently the Mifox RSET API allows authenticated users to query the database, for example say a user needs to query clients, with the current API users can request for a list or a particular client, request for a list of clients returns the whole user list to the front end in a json encoded string, but the user might not interested in all of those data that has been received, this causes huge performance hit within the multitenant environment. 

The idea of this project is to improve the performance of processing these large database queries by implementing server side pagination. This allows users to request a portion of a data set.

Required deliverable

  • Adding pagination and sorting capabilities to the REST API's exposed by the MifosX platform.
  • Update the reference User Interface to consume the same.
  • A proper documentation and tests for the above mentioned components.

Project implementation plan

  1.  Adding pagination capabilities to the back-end.

      • Implement necessary methods to handle Api request
        •  Update ‘XXXApiResources’ classes to handle api request. These classes use Jersey for dealing with request.

            Ex :

          @GET
          @Path("/paginated")
          @Consumes({ MediaType.APPLICATION_JSON })
          @Produces({ MediaType.APPLICATION_JSON })
          public String retrievePaginated(@QueryParam("offset") final int offset, @QueryParam("limit") final int limit){//implementation}
      • MIFOSX use spring data for data base write operation, and jdbc template for read operations. Pagination will be implemented on top of the read operations and have to implement an efficient algorithm to retrieve paginated data.

               Current implementation : Github pagination branch

                      This approach is more common and well understood in leading data bases, and easy for developers.

  2. Improve the performance.

      • The pagination algorithm could be improved in number of ways.
        • It could cache the number of pages available to remove the overhead of running the 'count' SQL each time.
        • It could make use of ScrollableResultSet support when fetching the rows.
        • It could make use of database specific features such as MySQL's support for the "LIMIT offset, count" syntax.

      • Response object creation algorithm.
        • Currently MifosX use google Gson for object serialization. Jack son has a better performance bench mark ,so will be look in to update the serialization classes to use Jackson.

  3. Update front-end interface to consume paginated data.

    • Getting familiar with the jquery data table plugin usage.
    • Use jquery data tables plugin to render the paginated data in the front end.

  4. Write unit test cases..

Project schedule

DurationDescription

May 3rd  –  May 27th

  • Getting familiar with the needed technologies .
  • Familiarize completely with the MIFOX functionality and the architecture.

May 28th – June 16th

  • Knowing each other of the developer community, Discuss project design and implementation plans with the mentor.

June 17th – July 28th

  • Implementation of task 1, 2

July 29th – Aug 2nd

  • Mid Evaluations

Aug 3rd – Sep 15th

  • Implementation of task 3, 4

Sep 16th – Sep 22nd

  • Further testing and improve documentation

Sep 23rd  – Sep 27th

  • Final evaluation

Additional Resources

MIFOSX-173 - Getting issue details... STATUS   MIFOSX-174 - Getting issue details... STATUS