Images (encoded base64) in my application cannot be sent through web server - swift

I am currently developing my iOS application which includes some feature uploading images in one time along with its album name.
I came up with a solution to use encoding base64 image in order to send nested json format instead of using multipart form data method.
My question is on my localhost, it seems like my application is capable to send many pictures in one time, let say 15 pictures. However, when it comes to sending through my web server (Amazon EC2 free tier), it seems like my application is capable to send up to 4 pictures at a time, if there are more than 4 pictures, nothing would appear.
I have tried to debug on networking part, it turns out that status 200 is returned with no images sent. My question is that does the problem occur due to server stuff or something ??
Updated
I think I've found some important insight. I will classify into two scenarios. What I have found on simulator debugging is that
i) I use a simulator to connect with my server. When I send only one picture, the size of it is around 252 bytes. Sending two pictures, they are 450 bytes. The weird thing is that sending more than 3 pictures, its size is calculated to be only 208 bytes. This is very weird, it is supposed to be higher when a number of pictures increases.
However, I remember that things work perfectly fine on my localhost; thus I try to debug on a simulator that connects with localhost to figure it out more.
ii) I use a simulator to connect with localhost. When I send one picture, it has 252 bytes. Sending 2 pictures, it is around 450 bytes and sending 4 pictures, it is around 1152 bytes. We can see that data's size here is growing when the number of pictures is increasing. The scenario ii) does make sense.
Anyway, I still have no idea what causes this problem; I believe this should involve with server stuff for sure. Please help !!

Related

Wordpress in waiting state

I built a website for someone and I used https://gtmetrix.com to get some analytics, mainly because the wait time is huge (~20 sec) without having any heavy images. Please find attached a screenshot here:
http://img42.com/05yvZ
One of my problems is that it takes quite a long time to perform the 301 redirect. Not sure why, but if someone has a key to the solution I would really appreciate. At least some hints to search would be nice.
The second problem is after the redirection, the waiting time is still huge. As expected I have a few plugins. Their javascripts are called approx. 6 secs after the redirection. Would someone please show me some directions on where to search please?
P.S. I have disabled all plugins and started from a naked plain Twenty Eleven theme, but I still have waiting times during redirection and smaller delay after redirection.
Thanks in advance
But a few suggestions:
1 and 2.) If the redirect is adding noticeable delays; test different redirect methods. There are several approaches to this -- including HTML meta and server side (ie PHP) methods -- I typically stick to server side; if it's showing noticeable delays using a server side method, this may be a great indicator that your experiencing server issues - and may be very well your server all along causing your speed issues; contact your host provider.
3.) Take a look at the size of your media. Images and Video; also Flash if your using any. Often cases it's giant images that were just sliced / saved poorly and not optimized for web in a image editing software like PhotoShop. Optimize your images for web and re-save them at a lower weight to save significant on load time. Also, many cases nowadays and you can avoid using clunky images in general by building the area out using pure CSS3. (ie. Odd repeatable .gifs to create gradients or borders etc.)

Import multiple photos to parse.com database

I'm trying to build an navigation app with place location and its photos.
I have 200 spot location names (String), its location (GeoPoints), and its image (JPG).
is it possible to upload the database including the image instantly?
I only managed to upload the String and GeoPoints database using json, but still can't do it for the image file.
anyway,
clicking one by one is definitely not an option. I got 200 images and still counting. It might reach 500 or more in several weeks.
thank you in advance,
how large are the images?
if you can scale (photos) them down a little bit and if you have multiple threads on the httpclient being used with parse.com then you should be able to saturate the WIFI / ISP bandwidth available to your device.
ie if you've got 10 Mb available upstream to the ISP then you ought to be able to optimize the use of multiple , async connections up so that you are pushing close to 10Mb of photos to parse.com.
It probably wont help much ( parse - android example ) but this was precisely the target of this question.
63 photos ( each 70K in sz ) upload in 3 seconds total .

"503/Failed to write to server" on a photo upload

When uploading a photo with the Facebook REST API, I occasionally get a "503/Failed to write to server" from Facebook.
I see in a capture of the TCP traffic that while I am sending the image with SSL, the Facebook server will suddenly send an Encrypted Alert (code21) and shortly after send a bunch of RST flags. This always happens in the middle of the transfer.
I have tested with various different images and it seems like the bigger the image, the more likely it is to fail. For example, a 3kb image will have a 100% success rate. A 400kb image will have ~50% success rate. A 600kb will have ~25 success rate and a 800kb or bigger image seems to fail all the time.
I should also add that there are times when even a much larger image (2000kb) will upload successfully many times in a row but once one failure happens, the results I mentioned above start to happen.
So my question is, what can be causing this behavior? Why would the upload fail on one attempt and succeed on subsequent attempts with the same image?

iPhone face detection remote database

Assuming i have a working facial recognition algorithm working for the iphone (comparison images would be stored on my machine). How can i expand this to compare image 'A' against images stored on a remote server?
Could someone give me an abstract definition? (I could download and temporarily store all images on my iphone, and then compare them against image 'A' however if i have hundreds of photos then it will take too long to process and be useless..).
Think like google goggles does - upload your image to the server and let the server crunch it. You can optimize the upload by sending a pre-processed part of the image first.
What is the input to your comparison algorithm, is it the subwindow containing the face detection? You could, just like peterept said, upload THAT smaller subwindow containing the face to the server and let the server do the work. If your input to the comparison algorithm is a set of features extracted from the face (statistics, etc.), then if it doesn't take too much CPU power to process the subwindow, you could extract those features on the phone and send them to the server for processing.
The main idea here is that you let the remote server do all the crunching, even if it is hundreds of photos (will still be faster than the phone, especially if you multithread). Then the trade-off is between sending the subwindow image or the feature set extracted from that subwindow, whichever's smaller to send.

How to troubleshoot streaming video (rtmp) performance?

I'm streaming videos via rtmp from Amazon Cloudfront. Videos are taking a loooong time to start playing, and I don't have any way of figuring out why. Normally I'd use the "Net" panel in Firebug or Web Inspector to get a good first impression of when an asset starts to load and how long it takes to be sent (which can indicate whether the problem is on the server end or network versus the browser rendering). But since the video is played within a Flash player (Flowplayer in this case), it's not possible to glean any info about the status of the stream. Also since it's served from Amazon Cloudfront, I can't put any kind of debugging or measuring tools on the server (if such a tool even exists).
So... my question is: what are some ways I can go about investigating this problem? I'm hoping there would be some settings I can tweak on either the front-end (flowplayer) or back-end (Cloudfront), but without being able to measure anything or even understand where the problem is, I'm at a loss as to what those could be.
Any ideas for how to troubleshoot streaming video performance?
You can use WireShark (can diessect RTMP) or Fiddler to check what is going on... another point (besides the client and the server) to keep in mind is your ISP.
To dig deeper you can use this http://rtmpdump.mplayerhq.hu/ OR http://www.fluorinefx.com/ OR http://www.broccoliproducts.com/softnotebook/rtmpclient/rtmpclient.php.
You need to keep in mind that RTMP isn't ideal since it usually bypasses proxies and tries to make direct connection... if this doesn't work it can fallback, but that means that some time has already passed (it wait for a connection timeout etc.)... if you have an option to set CloudFront/Flowplayer to RTMPT then I would recommend doing so since that uses Port 80 for the connection.
Presumably - if you go and attempt to view a video - then come back 20min later and hit it again - it loads quickly?
SAN -> Edge Servers ---> Client
This is all well and good in a specific use case (i.e. small filesize of the origin content, large long running cache) - but, it becomes an issue when it's scaled out, with lots of media hosts running content through the system i.e. CloudFront.
The media cache they keep on their edge servers gets dumped fairly often - after the cache is filled - start dumping from the oldest file in cache - so if you have large video files that are not viewed often - they won't be sitting in the edge server cache, and take a long time to transfer to the edges - thus, giving an utterly horrific end user experience.
The same is true of youtube, for example - go and watch some randomly obscure, high duration video - and try it through a couple of proxies, so you hit different edge servers, you'll see exactly the same thing occur.
I noticed a very noticable lag when streaming RMTP from cloudfront. I found that switching to straight http progressive from the amazon S3 bucket made the lag time go away.