Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
how do you crash a machine with infinite loop in ruby?
An infinite loop alone can't crash a "machine", unless it gets 100% CPU time (which no sane OS will allow).
You can create an infinite loop which will eat up memory without letting it be garbage collected, but this will just crash the current process.
You could instead create processes, which create other processes recursively (a fork bomb). This will manage to slow down and eventually crash a "machine", but any sane server will have a limitation on how many processes a user can spawn.
In Linux (or equivalant), you can keep opening files and never close them - at some point - you will start seeing "Too many open files" error - this can also hinder opening of new network connections. This can happen if one has not reviewed open file limits on the system and working with default settings.
You can also keep creating files with lot of data in the OS partition, and fill up the disk space which can eventually lead to unresponsive system. This can happen if you application creates too many log entries and you forget to rotate the files.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am working on an application in Go in which I am using goroutines. Each of which connects to third party servers and collects data which is then processed and used in application.
Just as an example :
for _, apiInfo := range apiInfoList {
go external1.GetResponse(searchReq)
go external2.GetResponse(searchReq)
go external3.GetResponse(searchReq)
}
Now these goroutines are running on single server.
Is it possible to run goroutines on individual servers. ?
In my case can I run it on three different servers?
A goroutine (it's a single word) by its very definition is a light-weight thread of execution inside a single process managed by an operating system's kernel.
Hence the question as stated has no sense: if you want a task to be carried out by a separate process you do not need a goroutine — you need a separate process (no matter whether it is to be run on the same machine or not).
To exchange data between separate processes, you need to use some form of IPC.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
the point that every request need some processing. I want to know if my resources enough or I have to upgrade it, or may be I have to test my code and optimize it.
My resources :
4 CPU and 8G ram.
Any outlines, test tools will be appreciated.
If you are serving a static small page - you will be able to serve hundreds of thousands requests per second on that hardware. If you have very "heavy" page which requires lots of server-side processing - it can be just few concurrent users.
I would recommend the following:
Get the load testing tool, for example see Open Source Load Testing Tools: Which One Should You Use? article for comparison.
Set it up to replicate real users as close as possible (headers, cookies, cache, AJAX requests, etc.), virtual users should follow main application use cases
Start with 1-2 virtual users and double check everything works as expected
Gradually increase the load to anticipated number of users and observe system behaviour and main metrics like response time, number of transactions per second, etc. If you are happy with the results - that's it. If not - identify the bottleneck (which is not necessarily your code) and fix it. Repeat. Use profiling tools to inspect your code and identify the most resources consuming parts. Refactor. Repeat.
You can also consider increasing load until your application starts breaking to see what fails first, will the system recover when the load gets back to normal, etc.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
While executing packages at first time the entire package loaded into memory then 2nd time execution it will executed from local memory.
if in case any update happened in any schema object which is used in the procedure within the package then how the execution happened?
its from server or local memory?
While executing packages at first time the entire package loaded into memory ...
When it is compiled the entire package is loaded to shared memory, but when you execute a package that is already compiled it is paged into shared memory (if it is not already) in 4kb chuncks.
As the name implies, shared memory is not dedicated to a single session.
The PL/SQL can be invalidated by changes to schema objects or other PL/SQL, in which case it is recompiled. However an individual session's context in then lost (eg your own variable values are then no longer valid). I forget which error this throws, though.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to screenscrape a bunch of pages and store them in a database using ActiveRecord. I messed around using EventMachine and Typhoeus but I get flaky results, mostly mysteriously empty records getting saved.
What's the trick? I had the best results with scraping pages and writing them to disk, then inserting them into the DB, but I'd really like to do it in a single pass.
Is anybody doing this successfully?
My guess is your threads are sharing an AR connection. This will cause problems, and anyway concurrency won't get records into your database any faster. I suggest you download concurrently and insert them in a single thread (like you've been doing.)
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So i have a number of methods i use to minimise load time when restoring a Windows Phone 7 application when it has been tombstoned and completely closed, and a user hits the back button or (in mango) navigates to your app from the multi-tasking switcher.
What methods do you use to make sure that the user doesn't see the "Resuming..." text for a second or two?
With Mango your application will be kept in memory until the device is running low in memory. So when the user comes back you can test it in the Application_Activated method:
if (!e.IsApplicationInstancePreserved)
{ //here your code to initilize database etc.
}else{
// nothing to do !
}
You should read this page on the Execution model of Mango: http://msdn.microsoft.com/en-us/library/ff817008(v=VS.92).aspx
In any case in the application_desactived method you should save all the data because you are not sure to be kept in memory until the user comes back.
For the resuming message (and it's also valid for the startup), you should be fast as you can to display the first page to your user. Even if this first page does the heavy work (query a local database, a remote service etc...). You give to the user the impression that your application is doing something and not stuck in the splash screen.