Content
You are here:
PUT requests always take 30(ish) seconds !!
Added by Tiago Geada almost 11 years ago
Hi,
I deployed openproject with apache (mod passenger) and I can’t figure why PUT requests are taking so long.
browser hits ‘submit’ on the update issue screen, and takes 30 seconds to get status 302 back from server. Also, on browser shows as a POST request, but production.log shows as PUT
funny thing is that apache log will also be written past those same 30 seconds, same time that production.log will have new lines..
What should I be looking at?
Replies (23)
Also, I turned on MySQL logging, and:
These were the last queries before updating a issue (look at the time before each query)
130 Query SELECT `users`.* FROM `users` INNER JOIN `watchers` ON `users`.id = `watchers`.user_id WHERE ((`watchers`.watchable_type = ‘Issue’) AND (`watchers`.watchable_id = 312)) AND (users.status = 1) AND ( (`users`.`type` = ‘User’ OR `users`.`type` = ‘AnonymousUser’ OR `users`.`type` = ‘DeletedUser’ ) )
130 Query SELECT * FROM `users` WHERE (LOWER (mail) IN (‘luciano.dias@domain’,‘tiago.geada@domain’)) AND ( (`users`.`type` = ‘User’ OR `users`.`type` = ‘AnonymousUser’ OR `users`.`type` = ‘DeletedUser’ ) )
130 Query SELECT * FROM `trackers` WHERE (`trackers`.`id` = 11)
130 Query SELECT * FROM `issue_statuses` WHERE (`issue_statuses`.`id` = 9)
130 Query SELECT * FROM `enumerations` WHERE (`enumerations`.`id` = 4) AND ( (`enumerations`.`type` = ‘IssuePriority’ ) ) ORDER BY enumerations.position ASC
130 Query SELECT * FROM `custom_fields` WHERE (is_for_all=1) AND ( (`custom_fields`.`type` = ‘IssueCustomField’ ) ) ORDER BY position
130 Query SELECT * FROM `custom_fields` INNER JOIN `custom_fields_projects` ON `custom_fields`.id = `custom_fields_projects`.custom_field_id WHERE (`custom_fields_projects`.project_id = 10 ) AND ( (`custom_fields`.`type` = ‘IssueCustomField’ ) ) ORDER BY custom_fields.position
130 Query SELECT `custom_fields`.* FROM `custom_fields` INNER JOIN `custom_fields_trackers` ON `custom_fields`.id = `custom_fields_trackers`.custom_field_id WHERE (`custom_fields_trackers`.tracker_id = 11 ) AND ( (`custom_fields`.`type` = ‘IssueCustomField’ ) )
140202 18:29:07 130 Query SELECT * FROM `user_preferences` WHERE (`user_preferences`.user_id = 3) LIMIT 1
Then it took about 25 seconds or so and performed these:
140202 18:29:38 130 Query SELECT `journals`.id FROM `journals` WHERE (`journals`.`version` = 14 AND `journals`.`journaled_id` = 312 AND `journals`.`type` = ‘IssueJournal’ AND `journals`.id <> 1570) LIMIT 1
130 Query UPDATE `journals` SET `changes` = ‘—- {}\n\n’ WHERE `id` = 1570
130 Query SELECT * FROM `journals` WHERE (`journals`.journaled_id = 312) AND ( (`journals`.`type` = ‘IssueJournal’ ) ) ORDER BY journals.version DESC LIMIT 1
130 Query SELECT * FROM `users` WHERE (`users`.`id` = 3) AND ( (`users`.`type` = ‘User’ OR `users`.`type` = ‘AnonymousUser’ OR `users`.`type` = ‘DeletedUser’ ) )
130 Query COMMIT
And it took a few more seconds to show the response in the browser and everything else
Hi Tiago,
I don’t have an idea what the problem is (I have never heard of such a problem before), but we might be able to debug it :)
From your log I see that you use OpenProject 2.4 - is it an option for you to migrate to the recent 3.0 version? It is not officially marked as ‘stable’. However, our production systems (esp. openproject.org) are already running version 3.
Because we upgraded the whole software stack (ruby 2.0, rails 3) you might get rid of that problem. We don’t have an official upgrade guide yet, but I’ll ask Markus if he can answer here with his personal instructions. Once you are on OpenProject 3, you might consider using memcached for caching.
From your e-mail, I see that you have posted this related question (http://stackoverflow.com/questions/21514078) on StackOverflow. The wordpress site you added should not make a difference. The upgrades you did might change a thing - which ruby do you use? A system provided 1.8 ruby?
Do you have the same problem with the PUT request when you acces the site from a stand alone passenger? (so that we can be certain that your apache settings do no harm).
What if you start openproject via
RAILS_ENV=production script/server
?yours,
Philipp
Hi Philipp,
Thank you for your quick reply.
I did try running as a standalone (development, and now as RAILS_ENV=production) and same issue is happening.
I did try at the beginning to install 3.0, but it required ruby1.9 and there was some gem (can’t remember the problem for sure) that was giving me trouble regarding ruby 1.9, and as ruby 1.8 is default in debian wheezy, I stucked with 2.4
I never used ruby on rails before, and I’m a bit afraid of running into problems.
We already configured openproject to our needs and would like to have the lst problems possible.
Also you state ruby 2.0, I would need to install it from testing… I guess that would be OK.
We run a system provided ruby 1.8
How could I debug further?
What steps would one need to migrate to openproject 3?
Thank you in advance
Hi,
I created a chroot on Debian, messed arround installing ruby 2.0 and all… and managed after a few hick ups, to get openproject 3.0 up and running.
Looks great, and promissing. Deserves praise!
I must state, it is slightly sluggish’er than 2.4 … not sure if it is because both are running, or it is using memcached .. or whatever… I’ll try and figure out that later
Now, how would I replicate all data on existing 2.4 to this 3.0 instance? So we cold see what it would be like in production?
Hello again,
I really appreciate the praise :)
As I told you in my last post, I asked Markus if he can provide migration instructions (we need them anyway before the final release). He promised me to write those instructions and give you a response here, if the guide is online.
Basically the migration should go smooth. The only thing is that you have to be careful with plugins. Any plugin, which is not ported to OpenProject 3 cannot be used (until someone updates it). Do you use any plugins for your installation (and which ones)?
— philipp
Hello Philipp,
Again, thank you for your feedback, much welcome.
All the modules I installed, were the ones on https://www.openproject.org/projects/openproject/wiki/Installation_OpenProject_2_4#32-Install-plugins which I did remove just now. This should not represent a issue, right?
I guess I could try and clone the DB of 2.4 into the 3.0 ? haven’t checked if the SQL structure is the same…
I look forward to read Markus instructions, meanwhile, can I simply try and use a copy of 2.4 SQL structure on 3.0? Or is there some basic steps to perform?
While there are no instructions I could try and make it work. I’m not big on ruby nor ruby on rails, but I’m great with linux, sql and alikes…
Well I noticed that the SQL structure differs.
I will be waiting for Markus …
If you have removed the modules things should be fine (at a first glance) - most of these plugins have been merged into the OpenProject core anyways.
The SQL structure differs, but if you copy your 2.4 database and execute
bundle exec rake db:migrate
within the OpenProject 3 installation, it should be automatically updated.You also need to migrate uploaded files (attachments to issues etc.) - I am not sure on how this is done and will wait with you for Markus’ instructions :)
— philipp
Once again I thank you Philipp for your availability to help :)
I’m getting incomplete journals errors when migrating … what can I do?
I dumped 2.4 bd, imported it to newBD_development and ran db:migrate
after a short while the following popped:
Hi Tiago,
just remove those journals from your database that are mentioned in the list and execute
db:migrate
again.Kind regards,
Hagen
would that be journals.id or journals.journable_id ?
Hi Tiago,
please excuse, you need to delete those journals from the legacy journals table:
Cheers,
Hagen
Thanks Hagen, will try
Hi,
seems that INSERT statements are not being escaped …
I will try and find this line and replace the ’
Hi Tiago,
alternatively, you may just add
ActiveRecord::Base.connection.quote
todb/migrate/migration_utils/customizable_utils.rb
line 52 (right in front ofm.value
). This saves you from adapting each value by hand. And you may remove the single quotes ’ then too.Cheers
Thank you for your feedback. In the meanwhile I did use a UPDATE set value=REPLACE()….
Now I made it work, seems all great…
I now am on a stage where I’m trying to make it work in a production environment (I don’t mean openproject env, but system wide)
after fiddling with ruby versions and all, I’m now at a stage where opening openproject web page shows:
and production.log shows:
This is a rails 3 thing.
RAILS_ENV=production bundle exec rake assets:precompile
should solve this.
It worked!
I now have a working openproject 3.0 :)
I will be waiting for the attachments instructions and other comments…
We will move soon to 3.0 tho
Hey,
I wrote some instructions once for migrating one of our configurations from 1.5 to 3.0.
It’s pretty specific to those configurations but it might help you out: click
Didn’t have as much time today as I thought I would and still have to generalize those instructions a bit.
I’ll go over it tomorrow.
If you are using Project and Version documents let me know and I can give you a more detailed explanation on what you need to do to save those.
All other documents should be fine by using the openproject-documents plugin.
~ Markus
P.S. you don’t need to (and probably can’t) use the repositories mentioned in the instructions. Although there is a migration branch of openproject on github.
But I would try doing the migration with the plain openproject dev branch first.
Philipp Tessenow wrote:
I tried this option, and the result is a big speedup.
The only big problem is that all drop down menu’s stopped working, which is quite a big issue.
Hello Joey,
asset:precompile
only works for the production environment. Thus, you need to start the rails server like this:Does this work for you?
Kind regards,
Hagen
If you start your server with:
You have to deliver the assetes through the rails application. To make this happen you have to change this:
Best Ratzi
Aparantly i installed a development database instead of a production database for what reason, so that explains why i had issues with this.
Now when i run in Production mode, i get a error about some things not being found.
(in `query’: Mysql2::Error: Table ‘openproject.work_package_journals’ doesn’t exist: SHOW FULL FIELDS FROM `work_package_journals` etc…)
Is there a simple way to migrate the database to production?
EDIT: I already tried: ‘RAILS_ENV=production bundle exec rake db:migrate’ but that does not seems to copy anything, it just creates the tables in the database
EDIT2: NVM dirty fixed it just doing a dirty mysql copy of the development database to production. Thanks btw!