N G
N G

Reputation: 173

Meteor website takes too much time to load

I have a webApp built using meteor. Following are the specifications :

Meteor version : 1.8
Mongo Version : 4.0.5

Following is the list of packages I have used :

[email protected] twbs:[email protected] iron:router [email protected] fortawesome:fontawesome [email protected] [email protected] mrt:mathjax [email protected] momentjs:moment ian:[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] jss:jstree meteorhacks:subs-manager aldeed:template-extension reywood:publish-composite [email protected] stylus@=2.513.13 [email protected] iron:[email protected] [email protected] [email protected] [email protected] [email protected] simple:json-routes [email protected] aldeed:simple-schema rafaelhdr:google-charts meteorhacks:aggregate

The webApp is hosted on AWS ec2 instance with 16GB RAM and 04 processors. The application uses pub-sub method. Now the issue is that whenever there are more than 50 concurrent connections, the CPU usage crosses sixty-percent usage and the webApp becomes annoyingly slow to use. As per my findings, it could be because of two reasons, either the pub-sub schema that I have used is too heavy, i.e., I have used database subscriptions on each page extensively and meteor maintains an open connection continuously with it. Other reason that could be leading to extensive resource usage could be mongoDB usage. As per the dbStats, the db uses more than 06GB of RAM. Following are the details : enter image description hereenter image description here

I am not sure why such behaviour. Only way I can think of is to hit and trial (remove subscriptions and then test), but it would be too time consuming and also not full proof.

Could someone help me out as to how to proceed.

Upvotes: 2

Views: 103

Answers (1)

Billybobbonnet
Billybobbonnet

Reputation: 3226

Depending on the way your app is designed, data-wise, there can be several reasons for this lack of performance.

A few suggestions:

  • check that you have indexes in your collections
  • avoid doing aggregation in the publication process, i.e. denormalize the db, publish array of cursors instead, limit the size of the documents, etc.
  • filter the useless fields in the query
  • limit the amount of data to the relevant part (lazy load & paginated subscribe)
  • consider global pubs/subs for the collections you use a lot, instead of reloading them too often on a route based pattern
  • track small component based subs and try to put them at a higher level to avoid making for instance 30 subs instead of one

My best guess is that you probably need a mix of rationalizing the db "structure" and avoid the data aggregation as much as you can.

You may also have a misuse of the low level collection api (e.g. cursor.observe() stuff) somewhere.

Upvotes: 1

Related Questions