Rails: Waiting too long for showing modal












0














I have a Rails app showing a modal but it takes ages to display. How can I find a problem, why is it happening?




  • I found this answer indicating a problem with includes - but I have my page already loaded and need to show only a simple modal popup.


  • I checked my internet connection. Seems fine, and the rest of the website loads normally.
    enter image description here


  • Basically it is a dashboard with a list of events. When you hit "+" button, a modal should show up and you should be able to add an attendant.



So the event row.haml looks like this:



    = link_to new_admin_attendance_path(event_id: event.id, date: params[:date]), 
remote: true, class: 'btn btn-success' do %span.glyphicon.glyphicon-plus


When I click on the "+" button, new attendance code looks like this:



def new
@attendance = Attendance.new

if params[:event_id]
@attendance.event_id = params[:event_id]
end

respond_to do |format|
format.js
end
end



  • I also checked the database which is PostgreSQL and there is an index on the row event_id on the Attendances table.


  • This is a screenshot from Inspect->Network. What is being downloaded 16 seconds? (My colleague mentioned it took sometimes 2 minutes) enter image description here




    • After hitting "+" in dev environment, this is written in console:




enter image description here




  • I don't have access to the production database. I can only log to the AWS with ssh but no idea how to work with it.










share|improve this question




















  • 1




    Does your console show anything helpful?
    – jvillian
    Nov 21 '18 at 20:51










  • @jvillian I can't answer this question since I don't know how to work with the production :-X But when I run the app locally with a DB dump (almost 10 times less data), it runs nicely, check the event id: "event_id"=>"1935". On production it is "event_id=14814" and it takes 16 seconds. I guess there might be a problem with the database performance?
    – Ivanka Eldé
    Nov 21 '18 at 21:13












  • The code that you showed does not cause any query to be run. If you're worried about database performance, just run the query in rails console/directly in DB and check instead of guessing.
    – Marcin Kołodziej
    Nov 21 '18 at 22:10






  • 1




    You may want to edit your question with the generated queries, partial code (which I assume is causing the queries to be run), your models and optionally an EXPLAIN statement run on the slow queries.
    – Marcin Kołodziej
    Nov 21 '18 at 22:53






  • 1




    @IvankaEldé well, you are loading all customers from database for some reason. We don't see the code responsible for that so it is difficult to say anything more, but assuming you have a lot of customers in production this will take a really long time.
    – Marcin Kołodziej
    Nov 27 '18 at 8:21
















0














I have a Rails app showing a modal but it takes ages to display. How can I find a problem, why is it happening?




  • I found this answer indicating a problem with includes - but I have my page already loaded and need to show only a simple modal popup.


  • I checked my internet connection. Seems fine, and the rest of the website loads normally.
    enter image description here


  • Basically it is a dashboard with a list of events. When you hit "+" button, a modal should show up and you should be able to add an attendant.



So the event row.haml looks like this:



    = link_to new_admin_attendance_path(event_id: event.id, date: params[:date]), 
remote: true, class: 'btn btn-success' do %span.glyphicon.glyphicon-plus


When I click on the "+" button, new attendance code looks like this:



def new
@attendance = Attendance.new

if params[:event_id]
@attendance.event_id = params[:event_id]
end

respond_to do |format|
format.js
end
end



  • I also checked the database which is PostgreSQL and there is an index on the row event_id on the Attendances table.


  • This is a screenshot from Inspect->Network. What is being downloaded 16 seconds? (My colleague mentioned it took sometimes 2 minutes) enter image description here




    • After hitting "+" in dev environment, this is written in console:




enter image description here




  • I don't have access to the production database. I can only log to the AWS with ssh but no idea how to work with it.










share|improve this question




















  • 1




    Does your console show anything helpful?
    – jvillian
    Nov 21 '18 at 20:51










  • @jvillian I can't answer this question since I don't know how to work with the production :-X But when I run the app locally with a DB dump (almost 10 times less data), it runs nicely, check the event id: "event_id"=>"1935". On production it is "event_id=14814" and it takes 16 seconds. I guess there might be a problem with the database performance?
    – Ivanka Eldé
    Nov 21 '18 at 21:13












  • The code that you showed does not cause any query to be run. If you're worried about database performance, just run the query in rails console/directly in DB and check instead of guessing.
    – Marcin Kołodziej
    Nov 21 '18 at 22:10






  • 1




    You may want to edit your question with the generated queries, partial code (which I assume is causing the queries to be run), your models and optionally an EXPLAIN statement run on the slow queries.
    – Marcin Kołodziej
    Nov 21 '18 at 22:53






  • 1




    @IvankaEldé well, you are loading all customers from database for some reason. We don't see the code responsible for that so it is difficult to say anything more, but assuming you have a lot of customers in production this will take a really long time.
    – Marcin Kołodziej
    Nov 27 '18 at 8:21














0












0








0







I have a Rails app showing a modal but it takes ages to display. How can I find a problem, why is it happening?




  • I found this answer indicating a problem with includes - but I have my page already loaded and need to show only a simple modal popup.


  • I checked my internet connection. Seems fine, and the rest of the website loads normally.
    enter image description here


  • Basically it is a dashboard with a list of events. When you hit "+" button, a modal should show up and you should be able to add an attendant.



So the event row.haml looks like this:



    = link_to new_admin_attendance_path(event_id: event.id, date: params[:date]), 
remote: true, class: 'btn btn-success' do %span.glyphicon.glyphicon-plus


When I click on the "+" button, new attendance code looks like this:



def new
@attendance = Attendance.new

if params[:event_id]
@attendance.event_id = params[:event_id]
end

respond_to do |format|
format.js
end
end



  • I also checked the database which is PostgreSQL and there is an index on the row event_id on the Attendances table.


  • This is a screenshot from Inspect->Network. What is being downloaded 16 seconds? (My colleague mentioned it took sometimes 2 minutes) enter image description here




    • After hitting "+" in dev environment, this is written in console:




enter image description here




  • I don't have access to the production database. I can only log to the AWS with ssh but no idea how to work with it.










share|improve this question















I have a Rails app showing a modal but it takes ages to display. How can I find a problem, why is it happening?




  • I found this answer indicating a problem with includes - but I have my page already loaded and need to show only a simple modal popup.


  • I checked my internet connection. Seems fine, and the rest of the website loads normally.
    enter image description here


  • Basically it is a dashboard with a list of events. When you hit "+" button, a modal should show up and you should be able to add an attendant.



So the event row.haml looks like this:



    = link_to new_admin_attendance_path(event_id: event.id, date: params[:date]), 
remote: true, class: 'btn btn-success' do %span.glyphicon.glyphicon-plus


When I click on the "+" button, new attendance code looks like this:



def new
@attendance = Attendance.new

if params[:event_id]
@attendance.event_id = params[:event_id]
end

respond_to do |format|
format.js
end
end



  • I also checked the database which is PostgreSQL and there is an index on the row event_id on the Attendances table.


  • This is a screenshot from Inspect->Network. What is being downloaded 16 seconds? (My colleague mentioned it took sometimes 2 minutes) enter image description here




    • After hitting "+" in dev environment, this is written in console:




enter image description here




  • I don't have access to the production database. I can only log to the AWS with ssh but no idea how to work with it.







ruby-on-rails performance






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 11:20







Ivanka Eldé

















asked Nov 21 '18 at 20:47









Ivanka EldéIvanka Eldé

121111




121111








  • 1




    Does your console show anything helpful?
    – jvillian
    Nov 21 '18 at 20:51










  • @jvillian I can't answer this question since I don't know how to work with the production :-X But when I run the app locally with a DB dump (almost 10 times less data), it runs nicely, check the event id: "event_id"=>"1935". On production it is "event_id=14814" and it takes 16 seconds. I guess there might be a problem with the database performance?
    – Ivanka Eldé
    Nov 21 '18 at 21:13












  • The code that you showed does not cause any query to be run. If you're worried about database performance, just run the query in rails console/directly in DB and check instead of guessing.
    – Marcin Kołodziej
    Nov 21 '18 at 22:10






  • 1




    You may want to edit your question with the generated queries, partial code (which I assume is causing the queries to be run), your models and optionally an EXPLAIN statement run on the slow queries.
    – Marcin Kołodziej
    Nov 21 '18 at 22:53






  • 1




    @IvankaEldé well, you are loading all customers from database for some reason. We don't see the code responsible for that so it is difficult to say anything more, but assuming you have a lot of customers in production this will take a really long time.
    – Marcin Kołodziej
    Nov 27 '18 at 8:21














  • 1




    Does your console show anything helpful?
    – jvillian
    Nov 21 '18 at 20:51










  • @jvillian I can't answer this question since I don't know how to work with the production :-X But when I run the app locally with a DB dump (almost 10 times less data), it runs nicely, check the event id: "event_id"=>"1935". On production it is "event_id=14814" and it takes 16 seconds. I guess there might be a problem with the database performance?
    – Ivanka Eldé
    Nov 21 '18 at 21:13












  • The code that you showed does not cause any query to be run. If you're worried about database performance, just run the query in rails console/directly in DB and check instead of guessing.
    – Marcin Kołodziej
    Nov 21 '18 at 22:10






  • 1




    You may want to edit your question with the generated queries, partial code (which I assume is causing the queries to be run), your models and optionally an EXPLAIN statement run on the slow queries.
    – Marcin Kołodziej
    Nov 21 '18 at 22:53






  • 1




    @IvankaEldé well, you are loading all customers from database for some reason. We don't see the code responsible for that so it is difficult to say anything more, but assuming you have a lot of customers in production this will take a really long time.
    – Marcin Kołodziej
    Nov 27 '18 at 8:21








1




1




Does your console show anything helpful?
– jvillian
Nov 21 '18 at 20:51




Does your console show anything helpful?
– jvillian
Nov 21 '18 at 20:51












@jvillian I can't answer this question since I don't know how to work with the production :-X But when I run the app locally with a DB dump (almost 10 times less data), it runs nicely, check the event id: "event_id"=>"1935". On production it is "event_id=14814" and it takes 16 seconds. I guess there might be a problem with the database performance?
– Ivanka Eldé
Nov 21 '18 at 21:13






@jvillian I can't answer this question since I don't know how to work with the production :-X But when I run the app locally with a DB dump (almost 10 times less data), it runs nicely, check the event id: "event_id"=>"1935". On production it is "event_id=14814" and it takes 16 seconds. I guess there might be a problem with the database performance?
– Ivanka Eldé
Nov 21 '18 at 21:13














The code that you showed does not cause any query to be run. If you're worried about database performance, just run the query in rails console/directly in DB and check instead of guessing.
– Marcin Kołodziej
Nov 21 '18 at 22:10




The code that you showed does not cause any query to be run. If you're worried about database performance, just run the query in rails console/directly in DB and check instead of guessing.
– Marcin Kołodziej
Nov 21 '18 at 22:10




1




1




You may want to edit your question with the generated queries, partial code (which I assume is causing the queries to be run), your models and optionally an EXPLAIN statement run on the slow queries.
– Marcin Kołodziej
Nov 21 '18 at 22:53




You may want to edit your question with the generated queries, partial code (which I assume is causing the queries to be run), your models and optionally an EXPLAIN statement run on the slow queries.
– Marcin Kołodziej
Nov 21 '18 at 22:53




1




1




@IvankaEldé well, you are loading all customers from database for some reason. We don't see the code responsible for that so it is difficult to say anything more, but assuming you have a lot of customers in production this will take a really long time.
– Marcin Kołodziej
Nov 27 '18 at 8:21




@IvankaEldé well, you are loading all customers from database for some reason. We don't see the code responsible for that so it is difficult to say anything more, but assuming you have a lot of customers in production this will take a really long time.
– Marcin Kołodziej
Nov 27 '18 at 8:21












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420235%2frails-waiting-too-long-for-showing-modal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420235%2frails-waiting-too-long-for-showing-modal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python