|
Bob Morales posted:Ruby 1.8.7 (2009-12-24 patchlevel 248) Ruby Enterprise Edition 2010.01 https://github.com/ice799/memprof seems to make it look like you want the Rack Middleware doing the dirty work, but you might want its output to go somewhere other than your production log. At some point though, the time you spend on optimizing memory will cost more than a better deployment strategy (more smaller app servers). For me, it's always been cheaper to throw hardware (read: VPSes) at scaling once you get the app to not crash. Also, you should at least update Rails; 3.0.8 and 3.0.9 fix some security and SafeBuffer issues. If your test suite is good, you shouldn't worry about minor versions.
|
# ? Sep 23, 2011 00:43 |
|
|
# ? May 14, 2024 08:45 |
|
BonzoESC posted:https://github.com/ice799/memprof seems to make it look like you want the Rack Middleware doing the dirty work, but you might want its output to go somewhere other than your production log. My boss was spergin' out on me earlier for spending time working on this. Then he showed me stuff in New Relic for 2 hours "This is where you will find the problem", after I kept asking him how it was going to tell us what was making the processes grow and grow, the longer they ran. It doesn't have anything to do with how long a page loads or how long a SQL query takes! He also said if we throw hardware at it now, we'll just have to throw hardware at it in the future. There's no interest in adding additional web servers and a load balancer. Test suite? ahahaah We moved the offending app to 3.0.9 so we'll see what happens today.
|
# ? Sep 23, 2011 13:32 |
|
Bob Morales posted:
Ya know how Rails still has this dumb myth on IT DOESNT SCALE ENTERPRISE CUMGURGLE This right here. Doesn't matter if its Rails or Django or Drupal or loving Wordpress, if you're hitting the limits of your server then load balance that poo poo jesus loving christ.
|
# ? Sep 23, 2011 14:36 |
|
At Windy City Rails last weekend, Nic Williams did a decent talk about using threaded concurrency to wring performance out of your app without having to run a zillion Ruby processes that all utilize 150-200MB of Ram. Instead he espoused the use of an evented web server with a low memory footprint (nginx) and a threadsafe web server (trinidad) along with a threadsafe implementation of rails (Ruby 1.9.2 & Rails 3 with config.threadsafe set to true). He also had a couple interesting slides about memory performance between nginx and apache. Of course, trinidad requires Jruby, JDBC gems setup and a host of other changes. I spent the rest of the weekend playing around with it, but didn't get too far since my nginx skills are quite terrible, and work sprang up to occupy my attention. Anyhow, the talks should be up soon and that one was one of the more interesting ones from Saturday.
|
# ? Sep 23, 2011 16:52 |
|
.
maskenfreiheit fucked around with this message at 21:32 on Apr 28, 2019 |
# ? Sep 23, 2011 21:40 |
|
GregNorc posted:Is there a simple way I could just iterate over the data in a given column in a for loop? Nobody uses for loops in Ruby. Think iterators always. What you want is the CSV library, included in 1.9 and external in 1.8 as the 'FasterCSV' library. With it, you do this: code:
http://ruby-doc.org/stdlib/libdoc/csv/rdoc/index.html
|
# ? Sep 23, 2011 21:53 |
|
I want to set up an easy database with login/logout (Hobo for that I guess) features. People should be able to log in, add stuff to the database and that's pretty much that. Regular visitors can browse through these entries. Since it's been ages since I used Visual Basic (yes) and Java, and I don't have any interest in learning PHP/SQL for this simple project, I decided Ruby would be best for what I want. However, is there some kind of good resource (free if possible) for web developers on how to get starting in Ruby and setting up a half-decent website? I own all the resources to get it running, I just need to know how.
|
# ? Sep 26, 2011 01:37 |
|
I say ignore Rails for now, since it's like expert mode web development and Ruby usage. Rails design assumes you know a lot about web development and a fair bit about the language already. For a head start on the language the old Pickaxe book is a decent start. From there I'd suggest looking at the Sinatra framework. I suggest this because you're working closer to how the Ruby language actually works, you gain an understanding on how Ruby DSLs function and see how the different components of Ruby web development work like where Rack fits in and why it is awesome, the different templating and database layers, and so forth. Rails rather abstracts all of this away, and Rails also does a lot of crazy poo poo with the Ruby language that you just don't see anywhere else. Lots of people try to dive right into Rails and get really, really lost, angrypost about it on a blog or something and gives Rails and the Ruby language a bad rap from people who have no idea what they are doing. Please don't be that person.
|
# ? Sep 26, 2011 04:54 |
|
Hobo should be able to do everything that you one. It's very simplistic, but it would allow you to update entries and allow people to see the data, and could probably even be set up within 10 minutes. I would recommend these three places to start learning rails though: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book http://guides.rubyonrails.org/ http://railscasts.com/
|
# ? Sep 26, 2011 05:12 |
|
What are some good blogs/articles about setting up multiple front-end web servers with a load balancer (an all free-software Linux solution is preferred)? Right now we have a single web server running Apache/Passenger and a MySQL database server. We'd like to have 2+ web servers due to traffic, and for redundancy. Our database is 20GB and grows about a gig a month, but a lot of that data is 2+ years old and not used anymore. My boss was playing with the sliders on the Rackspace Cloud configuration page and basically said "We can get 4 8GB cloud servers for what we pay for our 1 server now..." but I tried to explain to him it's not quite that simple.
|
# ? Sep 27, 2011 02:57 |
|
Bob Morales posted:My boss was playing with the sliders on the Rackspace Cloud configuration page and basically said "We can get 4 8GB cloud servers for what we pay for our 1 server now..." but I tried to explain to him it's not quite that simple. You should also factor in the cost of your salary * how many hours loving around doing ops instead of building features.
|
# ? Sep 27, 2011 03:07 |
|
Bob Morales posted:What are some good blogs/articles about setting up multiple front-end web servers with a load balancer (an all free-software Linux solution is preferred)? First thing I'd do is some kind of data retention policy to prune old, unused data. You can't just have a database grow all the time without some kind of attempt to clean it. Apart from the obvious storage concerns, old data is useless data that pollutes your data stores usefulness. My personal thoughts are if you want to go the balancer route properly, i'd look at some other rack servers; thin/rainbows/mongrel - instead of passenger. That way you can split it out - a frontend web server running apache/nginx which is the 'entry point' to your users - feeding out over an internal network to several different balancers using mod_proxy. These balancers can connect to your database server individually. Blogs, not too sure, but that's the approach I use; when using nginx or apache as a simple pass-through for the balancers and a dedicated database box, you're not going to hit capacity on either of those before you have a rack full of balancer servers.
|
# ? Sep 27, 2011 09:21 |
|
How do you keep the web servers synchronized? Capistrano can push to more than one server but we have user data (images etc) that aren't in there. I take it we would need to implement some sort of shared storage between hosts?
|
# ? Sep 27, 2011 16:29 |
|
Most people use a CDN for static assets, which on setup will redirect requests from your servers to their network, and if the CDN doesn't have that asset then it'll fetch it from your server first. They're pretty painless to set up. For setting up identical servers Capistrano was used a lot for Rails application deployments, but there's now things like Chef or Puppet to help set up an identical servers from a blank OS installation to rolling out the app. Or just use Heroku.
|
# ? Sep 27, 2011 17:01 |
|
Bob Morales posted:How do you keep the web servers synchronized? Capistrano can push to more than one server but we have user data (images etc) that aren't in there. I take it we would need to implement some sort of shared storage between hosts? Depending on your level of traffic, your frontend apache / nginx server can 'act' as a CDN for static assets - i.e. images/etc. Your mod_rewrite rule that redirects requests to the balancers is normally only set up to forward to the balancers if the request path doesn't exist relative to the document root. Or use Chef. Or Puppet. Or just use heroku.
|
# ? Sep 27, 2011 23:14 |
|
Anybody else going to RubyConf this week/weekend?NotShadowStar posted:Or just use Heroku.
|
# ? Sep 27, 2011 23:36 |
|
Do any of you guys use Unicorn and it's "downtime-less restarts" with nginx? I'm using Github's configuration but get 502s during Unicorn restarts. The actions that are being called are very light on DB reads (maybe three queries for a total of 20 rows returned) but somehow as soon as Unicorn gets that USR2 it starts barfing. preload_app is true. code:
dexter fucked around with this message at 04:12 on Sep 29, 2011 |
# ? Sep 29, 2011 04:07 |
I'm having some trouble getting DateTime.strptime() to work properly. Getting "Argument Error (invalid date)"code:
|
|
# ? Sep 29, 2011 21:05 |
|
A MIRACLE posted:
In Ruby, single quoted strings are not parsed for interpolated variables. Not sure how necessary your conversion to string is, but keeping with the intent of your code: code:
|
# ? Sep 29, 2011 21:15 |
skidooer posted:In Ruby, single quoted strings are not parsed for interpolated variables. Not sure how necessary your conversion to string is, but keeping with the intent of your code: Thanks for the quick reply! I still have a lot to learn about this language.
|
|
# ? Sep 29, 2011 21:23 |
|
Here's me going on another tirade on you should learn the language first. Does C# have this problem, people diving right into ASP.NET MVC without knowing a lick of C#?
|
# ? Sep 29, 2011 22:41 |
|
But but but creating a blog in 15 minutes
|
# ? Sep 29, 2011 22:45 |
NotShadowStar posted:Here's me going on another tirade on you should learn the language first. Don't freak out, I'm very committed to learning Ruby standalone.
|
|
# ? Sep 29, 2011 23:51 |
|
Does anyone know how I can include associated objects in a query according to a scope? I have Companies with many Jobs, but Jobs expire after a certain amount of time, so when I do Company.includes(:jobs) I want to be able to limit what it includes to just active jobs. Is there any way to do this? I already have an 'active' scope on Jobs, and I was hoping I would be able to reuse that, but I'll take anything.
|
# ? Oct 10, 2011 02:55 |
|
Lamont Cranston posted:Does anyone know how I can include associated objects in a query according to a scope? I have Companies with many Jobs, but Jobs expire after a certain amount of time, so when I do Company.includes(:jobs) I want to be able to limit what it includes to just active jobs. Is there any way to do this? I already have an 'active' scope on Jobs, and I was hoping I would be able to reuse that, but I'll take anything. It doesn't look like you can reuse the scope, but the query interface documentation says: quote:You can specify conditions on the joined tables using the regular Array and String conditions. Hash conditions provides a special syntax for specifying conditions for the joined tables:
|
# ? Oct 10, 2011 15:05 |
|
Lamont Cranston posted:Does anyone know how I can include associated objects in a query according to a scope? I have Companies with many Jobs, but Jobs expire after a certain amount of time, so when I do Company.includes(:jobs) I want to be able to limit what it includes to just active jobs. Is there any way to do this? I already have an 'active' scope on Jobs, and I was hoping I would be able to reuse that, but I'll take anything. You can reuse scopes, just provide the name in the includes: code:
code:
|
# ? Oct 11, 2011 17:19 |
I have a scope-related question. I've implemented a many-to-many relationship in my app between categories and events. I want to be able to filter by a specific category. Here's the relevant code, (forgive me for its horribleness):code:
code:
A MIRACLE fucked around with this message at 16:21 on Oct 14, 2011 |
|
# ? Oct 14, 2011 16:17 |
|
A MIRACLE posted:
|
# ? Oct 14, 2011 18:02 |
|
Can anyone recommend any rails log parsing gems/plugins that dump all the log file goodies into a DB? I tried using request-log-analyzer to parse some log files and dump to a DB but couldn't get past an error that it kept throwing. The log parsing works fine when I don't pass the database storing option through, but when i do it chokes with: /Users/usernamehere/.rvm/gems/ruby-1.8.7-p352/gems/activerecord-3.1.0/lib/active_record/base.rb:1082:in `method_missing': undefined method `class_inheritable_accessor' for RequestLogAnalyzer:atabase::Base(abstract):Class (NoMethodError)
|
# ? Oct 19, 2011 02:06 |
|
That looks like a bug. File an issue
|
# ? Oct 19, 2011 02:58 |
|
BrokenDynasty posted:Can anyone recommend any rails log parsing gems/plugins that dump all the log file goodies into a DB? Do you have more of the stack trace?
|
# ? Oct 19, 2011 05:47 |
|
I've been avoiding test driven development like the plague. Up till now, my situation has been "If it works in a web browser, it's all good!" which isn't gonna fly for much longer. I need some help understanding rspec and how it works. I'm using dos and have no idea how to test code. A good instance would be making sure a password has a minimum of 6 characters and one number. Does anyone have a link to the most basic tutorial on how to test a script and/or install rspec? (I'm not even sure if it's installed or not.) I feel pathetic that I've been testing in the browser.
|
# ? Oct 24, 2011 19:38 |
|
ZanderZ posted:I've been avoiding test driven development like the plague. Up till now, my situation has been "If it works in a web browser, it's all good!" which isn't gonna fly for much longer. Read this book If your answer is 'I'm not gonna read a book' gently caress you, read the book.
|
# ? Oct 24, 2011 19:53 |
|
You definitely want the above book. In addition the free Rails Tutorial will walk you through creating a twitter clone test-first using modern testing tools.
|
# ? Oct 25, 2011 01:34 |
|
Not sure what thread to put this in, but I figured this was best: My project right now is using Compass to compile CSS files from SASS source. The SASS files live in /views/stylesheets/, and when it detects changes Compass puts the compiled CSS into /public/stylesheets/. Is there any reason I should check the compiled CSS into git since the SASS is already checked-in and Compass will generate the CSS from scratch with a simple rake styles compile anyhow?
|
# ? Oct 27, 2011 06:04 |
|
Deus Rex posted:Is there any reason I should check the compiled CSS into git since the SASS is already checked-in and Compass will generate the CSS from scratch with a simple rake styles compile anyhow? Your intuition is correct. Generally it's a good idea to avoid checking in compiled things.
|
# ? Oct 27, 2011 06:28 |
|
Pardot posted:Your intuition is correct. Generally it's a good idea to avoid checking in compiled things. Neat! I thought I would run into an issue because my app is deployed to Heroku and thus Compass wouldn't be able to write the compiled stylesheets, but it turns out Heroku already has an article on getting around that.
|
# ? Oct 28, 2011 00:57 |
|
Deus Rex posted:Neat! I thought I would run into an issue because my app is deployed to Heroku and thus Compass wouldn't be able to write the compiled stylesheets, but it turns out Heroku already has an article on getting around that. You should be on the cedar stack, and if you are, everything is writable and you don't need to do anything special. It's still ephemeral, of course, but you don't have to dance around with /tmp Also easiest is if you just have it compile on app boot, but if you want to get fancy if you have it compile with rake assets:precompile it'll happen at slug creation time.
|
# ? Oct 28, 2011 01:15 |
|
Pardot posted:You should be on the cedar stack, and if you are, everything is writable and you don't need to do anything special. It's still ephemeral, of course, but you don't have to dance around with /tmp I committed some compiled poo poo on Sunday just to get the app working, but tomorrow it's definitely moving to cedar.
|
# ? Oct 28, 2011 14:12 |
|
|
# ? May 14, 2024 08:45 |
|
Deploying to Heroku Cedar, having just ripped the precompiled assets out:code:
|
# ? Oct 30, 2011 23:46 |