rails css在heroku上加载需要7秒

时间:2016-01-20 15:29:01

标签: ruby-on-rails heroku

我正在努力让我的rails应用程序尽快加载,

问题是CSS似乎需要一段时间才能加载。

关于它为什么的任何想法?我没有任何大图像或几乎没有任何外部资源请求。 这就是我回到网页请求网站

Image of stats

请记住,这个应用程序非常默认,大多数默认设置仍在使用中。也许我没有添加/删除一些?

Heroku登录推送

Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 658 bytes | 0 bytes/s, done.
Total 8 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Using set buildpack heroku/ruby
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.3
remote: -----> Installing dependencies using bundler 1.9.7
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Using i18n 0.7.0
remote:        Using rake 10.5.0
remote:        Using json 1.8.3
remote:        Using minitest 5.8.3
remote:        Using thread_safe 0.3.5
remote:        Using builder 3.2.2
remote:        Using erubis 2.7.0
remote:        Using mini_portile2 2.0.0
remote:        Using rack 1.6.4
remote:        Using mime-types 2.99
remote:        Using arel 6.0.3
remote:        Using addressable 2.4.0
remote:        Using execjs 2.6.0
remote:        Using ice_nine 0.11.1
remote:        Using bcrypt 3.1.10
remote:        Using sass 3.4.21
remote:        Using coffee-script-source 1.10.0
remote:        Using thor 0.19.1
remote:        Using concurrent-ruby 1.0.0
remote:        Using orm_adapter 0.5.0
remote:        Using multi_json 1.11.2
remote:        Using multipart-post 2.0.0
remote:        Using equalizer 0.0.11
remote:        Using uber 0.0.15
remote:        Using hashie 3.4.3
remote:        Using newrelic_rpm 3.14.1.311
remote:        Using pg 0.18.4
remote:        Using bundler 1.9.7
remote:        Using rails_serve_static_assets 0.0.4
remote:        Using rails_stdout_logging 0.0.4
remote:        Using rubyzip 1.1.7
remote:        Using tilt 2.0.2
remote:        Using tzinfo 1.2.2
remote:        Using descendants_tracker 0.0.4
remote:        Using nokogiri 1.6.7.1
remote:        Using mail 2.6.3
remote:        Using rack-test 0.6.3
remote:        Using warden 1.2.4
remote:        Using autoprefixer-rails 6.3.1
remote:        Using uglifier 2.7.2
remote:        Using coffee-script 2.4.1
remote:        Using figaro 1.1.1
remote:        Using sprockets 3.5.2
remote:        Using elasticsearch-api 1.0.15
remote:        Using faraday 0.9.2
remote:        Using representable 2.3.0
remote:        Using launchy 2.4.3
remote:        Using rails_12factor 0.0.3
remote:        Using activesupport 4.2.5
remote:        Using axiom-types 0.1.1
remote:        Using coercible 1.0.0
remote:        Using bootstrap-sass 3.3.6
remote:        Using loofah 2.0.3
remote:        Using elasticsearch-transport 1.0.15
remote:        Using roar 1.0.4
remote:        Using letter_opener 1.4.1
remote:        Using rails-deprecated_sanitizer 1.0.3
remote:        Using globalid 0.3.6
remote:        Using activemodel 4.2.5
remote:        Using jbuilder 2.4.0
remote:        Using rails-html-sanitizer 1.0.2
remote:        Using virtus 1.0.5
remote:        Using activejob 4.2.5
remote:        Using activerecord 4.2.5
remote:        Using elasticsearch 1.0.15
remote:        Using rails-dom-testing 1.0.7
remote:        Using gogokit 0.4.1
remote:        Using friendly_id 5.1.0
remote:        Using searchkick 1.1.2
remote:        Using actionview 4.2.5
remote:        Using actionpack 4.2.5
remote:        Using actionmailer 4.2.5
remote:        Using railties 4.2.5
remote:        Using kaminari 0.16.3
remote:        Using sprockets-rails 3.0.0
remote:        Using simple_form 3.2.1
remote:        Using coffee-rails 4.1.1
remote:        Using responders 2.1.1
remote:        Using jquery-rails 4.1.0
remote:        Using rails 4.2.5
remote:        Using sass-rails 5.0.4
remote:        Using turbolinks 2.5.3
remote:        Using devise 3.5.4
remote:        Bundle complete! 28 Gemfile dependencies, 83 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Bundle completed (0.44s)
remote:        Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        Asset precompilation completed (18.85s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote:
remote: ###### WARNING:
remote:        No Procfile detected, using the default web server (webrick)
remote:        https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for buildpack -> console, rake, web, worker
remote:
remote: -----> Compressing... done, 128.8MB
remote: -----> Launching...
remote:        Released v118
remote:        https://appname.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.... done.
To https://git.heroku.com/appname.git
   0f229c2..2e28cf4  master -> master

Heroku登录首页加载

2016-01-20T16:02:20.753089+00:00 heroku[router]: at=info method=GET path="/" host=app.co.uk request_id=9c50e3ce-2145-43ed-b2af-61ee1417bd45 fwd="212.250.145.155" dyno=web.1 connect=0ms service=221ms status=200 bytes=12549
2016-01-20T16:02:20.533243+00:00 app[web.1]: => Rails 4.2.5 application starting in production on http://0.0.0.0:30722
2016-01-20T16:02:20.533245+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-01-20T16:02:20.533239+00:00 app[web.1]: => Booting WEBrick
2016-01-20T16:02:20.533246+00:00 app[web.1]: Started GET "/" for 212.250.145.155 at 2016-01-20 16:02:20 +0000
2016-01-20T16:02:20.533244+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-01-20T16:02:20.730370+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.4ms)
2016-01-20T16:02:20.678270+00:00 app[web.1]: Processing by PagesController#home as HTML
2016-01-20T16:02:20.728440+00:00 app[web.1]:   Rendered layouts/_navigationhomepage.html.erb (0.4ms)
2016-01-20T16:02:20.725486+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/homepage (1.5ms)
2016-01-20T16:02:20.730751+00:00 app[web.1]: Completed 200 OK in 52ms (Views: 30.1ms | ActiveRecord: 0.0ms)
2016-01-20T16:02:20.729510+00:00 app[web.1]:   Rendered layouts/_messages.html.erb (0.6ms)
2016-01-20T16:02:20.981877+00:00 heroku[router]: at=info method=GET path="/assets/application-ad36cab3e5aa3030a9cfbb0982325e77da82625de431bcd75196b4d4196eb7a0.css" host=app.co.uk request_id=733d1ee0-cc8b-47d5-a2f3-c2b472e63530 fwd="212.250.145.155" dyno=web.1 connect=0ms service=6ms status=304 bytes=133
2016-01-20T16:02:21.029408+00:00 heroku[router]: at=info method=GET path="/assets/2logo-df62249d4aad53e2130552392921edc3d75793fba78bf8561b6695f2d5dd578b.png" host=app.co.uk request_id=38c49f11-cba9-4d67-a21f-821a9bbbb2c9 fwd="212.250.145.155" dyno=web.1 connect=0ms service=4ms status=304 bytes=133
2016-01-20T16:02:21.069406+00:00 heroku[router]: at=info method=GET path="/assets/1logo-163a0feae2f331a3a191a41da54c150b04bccddaff32ceed3ad657ca5e908ea3.png" host=app.co.uk request_id=f22e78f3-ee78-499d-b87a-36bd7336bf97 fwd="212.250.145.155" dyno=web.1 connect=0ms service=5ms status=304 bytes=133

1 个答案:

答案 0 :(得分:1)

使您的服务器较低的一个原因是您正在使用webrick进行生产。

这是来自您的部署日志:

  

remote:######警告:远程:没有检测到Procfile,使用   默认Web服务器(webrick)remote:
  https://devcenter.heroku.com/articles/ruby-default-web-server

将服务器更新为unicorn或您想要的任何内容的时间。