Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Advantages and Disadvantages of running a service in different process?

I want to run a long running Service in the background in my App.so i am using Service for that but in the service there is tag called android:process So my service is like..

<service
        android:name="com.purpleshade.services.ApplicationService"
        android:process=":myprocess">

Question::

So i want to know about the Advantages and disadvantages of running a Service in different Process.

like image 812
kalyan pvs Avatar asked Dec 18 '13 11:12

kalyan pvs


People also ask

What are the advantages of service companies over the other types of business?

Plus, service-based businesses are cheaper to start than the manufacturing and retail costs needed for a product company. The service industry is also faster to scale up in terms of revenue potential than other industries like retail or manufacturing because it can quickly be scaled horizontally versus vertically.

What is the disadvantage of service business?

Not easy to scale: If you're like a lot of agencies that charge hourly for services or perform project-based work, then your revenue is directly correlated to the number of billable hours. This requires you to constantly hire more people to deliver additional services and be able to grow the company.


1 Answers

Off the top of my head...

Downsides:

  • You have to use interprocess communication to talk to it, which is slower than if it were in the same process as the client.
  • Debugging becomes more difficult, as now there is a different process you potentially need to attach to.
  • If it crashes, it crashes independently of your main process. One might argue this is an upside too though. Something to consider.
  • Special care is needed in any initialization code, such as in your Application instance. There will be an instance of the Application context for each process. So, for example, if you are initializing something like GCM, you probably want to make sure only doing so in the main process. (Referring to this, specifically: http://developer.android.com/reference/android/app/Application.html)

Upside:

  • The only real upside I can think of, and really the only time I've used a separate process, is that you get a whole new heap space to work with independent of the main process. Useful if you need this memory for some operation.
like image 196
Eric Schlenz Avatar answered Oct 21 '22 03:10

Eric Schlenz