Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7712693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:41:46+00:00 2026-06-01T01:41:46+00:00

I’ve a problem with a slow post request in a RoR app. the project

  • 0

I’ve a problem with a slow post request in a RoR app.
the project is a distribuited system wher the client send a lot of photos and the server save those in DB.
I use MySql server 5.1, both client and the server are in the same local network and they are programmer in RoR….
the client send 10 photo in a single request. the 10 photos are send in an array structure in yaml format.
the request is:

res = Net::HTTP.post_form(uri, :mac => 'String', :value => 'Yaml_array_images_data', :num => 10)

and the log says:

`Started POST "/events/save_photo" for 192.168.0.113 at 2012-03-30 09:45:10 +0200
  Processing by EventsController#save_photo as */*
  Parameters: {"data_type"=>"image", "value"=>"--- \n- !binary |\n  /9j/2wCEAAoH
BwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYI...", "created_at"=>"--- \n- 2012-03-30 09:26:29 +02:00 \n-....", "mac"=>"00606E91E5D2"}
(0.3ms)  SET PROFILING=1
  Device Load (1.2ms)  SELECT SQL_NO_CACHE `devices`.* FROM `devices` 
WHERE `devices`.`mac` = '00606E91E51E' LIMIT 1
  CACHE (0.0ms)  SELECT `devices`.* FROM `devices` WHERE `devices`.
`mac` = '00606E91E51E' LIMIT 1
   (0.3ms)  BEGIN
  SQL (2.9ms)  INSERT INTO `multimedia` (`created_at`, `data`, `eve
nt_id`, `updated_at`) VALUES ('2012-03-30 07:45:00', x'f22b19237b63f1c8c40da49ae
5eb68969dd3cf28193ba6a3704fe2f286494439eea4f9071bb6ef9de530ccaaab235a402e2d94aad
2f4f1b90df022c23078f543bc6ca1c6fe8b17af45eae865bb....)
(0.3ms)  SET PROFILING=1
  Device Load (1.2ms)  SELECT SQL_NO_CACHE `devices`.* FROM `devices` 
WHERE `devices`.`mac` = '00606E91E51E' LIMIT 1
  CACHE (0.0ms)  SELECT `devices`.* FROM `devices` WHERE `devices`.
`mac` = '00606E91E51E' LIMIT 1
   (0.3ms)  BEGIN
  SQL (2.9ms)  INSERT INTO `multimedia` (`created_at`, `data`, `eve
nt_id`, `updated_at`) VALUES ('2012-03-30 07:45:00', x'f22b19237b63f1c8c40da49ae
5eb68969dd3cf28193ba6a3704fe2f286494439eea4f9071bb6ef9de530ccaaab235a402e2d94aad
2f4f1b90df022c23078f543bc6ca1c6fe8b17af45eae865bb...)
(44.0ms)  COMMIT
   (0.3ms)  BEGIN
  SQL (0.8ms)  INSERT INTO `events` (`created_at`, `data_type`, `devic
e_id`, `element_id`, `multimedia_id`, `name`, `status`, `updated_at`, `value`) V
ALUES ('2012-03-30 07:45:00', 'image', 19, 413397, 1066303, 'photo', NULL, '2012
-03-30 07:45:11', '--- 0\n...\n')
   (38.2ms)  COMMIT
   (0.3ms)  BEGIN
  SQL (2.9ms)  INSERT INTO `multimedia` (`created_at`, `data`, `eve
nt_id`, `updated_at`) VALUES ('2012-03-30 07:45:01', x'f22b19237b63f1c8c40da49ae
5eb68969dd3cf28193ba6a3704fe2f28...)
....
for 10 times insert a record in multimedia and one in events table
...
(33.0ms)  COMMIT
   (0.3ms)  BEGIN
   (0.4ms)  SET PROFILING=1
   (1.3ms)  SELECT SQL_NO_CACHE 1 FROM `devices` WHERE (`devices`.`mac
` = BINARY '00606E91E51E' AND `devices`.`id` != 19) LIMIT 1
   (0.7ms)  UPDATE `devices` SET `elem_photo_id` = 413408, `updated
_at` = '2012-03-30 07:45:12' WHERE `devices`.`id` = 19
   (34.5ms)  COMMIT
Rendered events/save_photo.html.erb (0.2ms)
Completed 200 OK in 1957ms (Views: 10.2ms | ActiveRecord: 1466.6ms)`

My first problem is the difference by total time and the sum between views time and activerecord time.

After that this times are in the log of the server, so those are the execution time of the request. If I take the time, in the client, from send request to receive respond, it’s 3,6 seconds! Why? I don’t think that in local network are needed 2 second to transfer 200k!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:41:47+00:00Added an answer on June 1, 2026 at 1:41 am

    there’s a lot of things happening between client sending request and server sending response

    to name a few:

    1. client resolves dns(usually it’s cached)
    2. client initiates http connection
    3. client actually posts the data
    4. whatever server you have there accepts post request and enqueues it to be processed by your rails stack
    5. request goes through all the rack middlewares you have before actually hitting your controller
    6. your request is processed by controller and response is generated
    7. response is then transferred to client and browser parses and renders it

    what you see in your server logs is probably only point 6, everything else depends on your app setup and properties of your response(html with lots of css, javascripts, images, etc)

    regarding your problem with time differences in this line:

    Completed 200 OK in 1957ms (Views: 10.2ms | ActiveRecord: 1466.6ms)
    

    detailed time consumption(in parenthesis) is not entirely detailed. it is missing GC time(which probably was invoked if you send files as yaml-formatted parameters), it is also missing time spent in your before filters and action itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from
I'm trying to create an if statement in PHP that prevents a single post
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.